Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Wait until process completes

Status
Not open for further replies.

dehat01

Technical User
Mar 10, 2003
6
US
When I use the 'Run method', I generally use the 'True' value to force the process to wait until completion before returning to script execution. However, despite this, the script oftens continues before the process ends. For example, I want to install two applications and set the second installation to wait until the first application finishes. Sometimes the second application starts installing before the first has completed. Is there any other way to force a process to wait? I've tried 'sleep' commands, but the timing is too difficult to predict. Is there a better way to make an application wait iuntil a process ends?
 
dehat01, Wshell.run DO wait until the process you ran is finished. To my mind, your problem id due to the fact that the launched process runs a new process then stops giving back the hand to your script.
You can verify that by creating 2 scripts :
- in first one, call the second one by Wshell.run(with wait boolean set to true)
- in second one, call any soft (calc.exe) for example with wit boolean to false.
- first script will continue even if you don't close calc.exe.

One easy way to overlap this problem is to find a file or a registry key written by your first installing program at the end of its process. As long as this file or regKey doesn't exist, loop and sleep. Water is not bad as long as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top