Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Waiting for process completion
#2
run returns process handle. It is different than window handle. You can use various methods to wait until program exits:

Code:
Copy      Help
;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"


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)