Siegurt wrote:This pretty much works:
- Code:
@echo off
"crawl.exe"
for /F %%i in ('dir /B /O:-D "morgue\morgue*.txt"') do (
call :open "%%i"
exit /B 0
)
:open
start "dummy" "morgue\%~1"
exit /B 0
Drop that into a batch (whatever.bat) file in your crawl directory and run it to open crawl. It should open the most recent morgue file when crawl closes. You may have to adjust the crawl morgue directory (If it's not a subfolder of wherever crawl is installed) and this calls 'crawl.exe' which on my system is the console version of crawl.
Could be improved by storing the latest modification time found in the morgue directory, then opening each of the files that are newer than that (avoiding the 'I didn't really care about that character, I wanted the other one that died this session' problem)
Yet another approach, if you have Python installed, is this:
- Code:
#!/usr/bin/python
#
# The above is required for identification, even on Windows, IIRC.
#
# Ctrl+C or Ctrl+D to exit.
#
import sys, os, time
import glob
from subprocess import call
last_files=set(glob.glob('morgue\\morgue*.txt'))
while 1:
these_files = set(glob.glob('morgue\\morgue*.txt'))
diff = these_files.difference(last_files)
if diff:
for d in diff:
call(['start','dummy',d])
last_files=these_files
time.sleep(15) # 15s between scans.
Which is admittedly inefficient with its repeated rescans, but will detect and open each new morgue as-it-happens, rather than at the end of each session.