[Tutor] program that 'waits' for file?

Tim Golden tim.golden at viacom-outdoor.co.uk
Tue Aug 29 13:08:15 CEST 2006


[Kay White]

| I'm trying to make a program that will wait for a specific 
| file to be made by another program, and when that happens it 
| opens and modifies that file. The other program is a 
| commercial game that allows the player to take screenshots. 
| It saves the screenshots in a particular directory, naming 
| each one "screenshot#.bmp". The # is a number that increases 
| with each new file. 

Given the ".bmp" suffix, I'm going to assume you're running
on some flavour of Windows. In that case, you might want to
make use of some form of directory-monitoring (possibly inside
a thread) which would watch the directory where the screenshots
are saved and reacts when a file is created within.

Have a look at:

http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_for_c
hanges.html

for a few possibilities.

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________


More information about the Tutor mailing list