Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Detecting when an App Completes Saving File

Keywords:    fileexist==0

Question:

Using a WinBatch script I load up and save a large Excel file (700k+). I would like to detect when Excel completes the save before continuing. I have been using the TimeDelay statement but I'm wondering if there is a better way. Can I tell when the cursor changes from an hourglass icon to an arrow, indicating the processor is free for more work?

Answer:

One cute trick is to check the file size. The filesize is zero until the save is complete.

Something like:

	;Start file save
	SendKeysTo("~Excel","!fs")
	While FileSize("c:\xxx\yyy.xls")==0
	   TimeDelay(1)
	endWhile

You might also use the Control Manager Extender and the cGetWndCursor to inspect an application's mouse cursor.


Article ID:   W13146
Filename:   Detect when App Finishes Saving File.txt