06-06-2005, 07:39 PM
run returns process handle. It is different than window handle. You can use various methods to wait until program exits:
;Waiting for process handle
int h3=run("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE");wait 15 p
int w2=act(win("Document1 - Microsoft Word" "OpusApp"))
lef 574 44 w2
mes "onereporter lock"
wait 0 H h3
CloseHandle h3
mes "end onereporter lock"
;Waiting for window's program exit (internally it is almost the same as above)
run("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE");wait 15 p
int w2=act(win("Document1 - Microsoft Word" "OpusApp"))
lef 574 44 w2
mes "onereporter lock"
wait 0 WP w2
mes "end onereporter lock"
;Getting window handle and waiting until it is closed
int w1
run("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE" "" "" "" 0 "Word" w1)
lef 574 44 w1
mes "onereporter lock"
wait 0 -WC w1
mes "end onereporter lock"
;Combined 2 and 3. This is probably the best.
int w1
run("C:\Program Files\Microsoft Office\OFFICE11\WINWORD.EXE" "" "" "" 0 "Word" w1)
lef 574 44 w1
mes "onereporter lock"
wait 0 WP w1
mes "end onereporter lock"