The uwaitfor command causes the process to wait until the Windows application, identified by the var variable, terminates or the time specified by the expr variable elapses.
UWAITFOR var, expr THEN statement(s) ELSE statement(s)
var | Must be an identifier returned by the uexecute command. |
expr | Indicates time, in 1/100th seconds. |
THEN/ELSE statements | If the uwaitfor command time expires, the ELSE clause is executed.
If the application terminates, the THEN clause is executed. |
Example 1
* * Launch Notepad; Allow user 3 seconds to * Complete edit. If not done in 3 seconds * Close application for them. * UEXECUTE "NOTEPAD.EXE" RETURNING HANDLE UWAITFOR HANDLE, 300 ELSE UMESSAGE TO HANDLE,16,0,"" END
Example 2
Running the following program will close Notepad.exe after 5 seconds:
001 UEXECUTE "NOTEPAD.EXE" RETURNING HANDLE 002 003 UWAITFOR HANDLE, 500 THEN 004 __PRINT "THANKS FOR WAITING" 005 END ELSE 006 __UMESSAGE TO HANDLE,16,0,"" 007 END