![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Want to understand why this doesn't work right, please I cobbled together a very basic script to run a program, sleep, run the program again, and Echo "I'm done". Real simple: Dim a wshell object wshell.Run Command line Sleep wshell.Run Command line wscript.Echo "I'm done" The program does launch and run as desired. I had too long of a sleep time at first and thought the script was done, then it suddenly launched again! That's when I decided to cut the sleep time and put in the Echo to tell me when the script is completed. I think I'm missing some pretty basic understanding, though. I ran the script, the program launched, and I got my message box before the program finished. The program did not launch a second time. That was not the behavior I expected! I thought the program would run and close, THEN sleep, run and close again, THEN echo. So I suspect the Run launches the program in a process thread totally independant of the script? So it does the Run line and immediately does the Sleep time? And if the program is still running by the time Sleep is over, it may launch a second instance or it may see the first instance still running and pass on it, and then immediately Echo? If this is the case, is there any way I can delay the progression from Run to Sleep and Run to Echo until the program is finished and closes by itself? Ed |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Want to understand why this doesn't work right, please Ed from AZ schrieb: Quote: > I cobbled together a very basic script to run a program, sleep, run > the program again, and Echo "I'm done". Real simple: > Dim a wshell object > wshell.Run Command line > Sleep > wshell.Run Command line > wscript.Echo "I'm done" > > The program does launch and run as desired. I had too long of a sleep > time at first and thought the script was done, then it suddenly > launched again! That's when I decided to cut the sleep time and put > in the Echo to tell me when the script is completed. > > I think I'm missing some pretty basic understanding, though. I ran > the script, the program launched, and I got my message box before the > program finished. The program did not launch a second time. That was > not the behavior I expected! I thought the program would run and > close, THEN sleep, run and close again, THEN echo. > > So I suspect the Run launches the program in a process thread totally > independant of the script? So it does the Run line and immediately > does the Sleep time? And if the program is still running by the time > Sleep is over, it may launch a second instance or it may see the first > instance still running and pass on it, and then immediately Echo? > > If this is the case, is there any way I can delay the progression from > Run to Sleep and Run to Echo until the program is finished and closes > by itself? > > Ed bWaitOnReturn parameter. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| I don't understand | Vista mail | |||
| This one I understand? | PowerShell | |||
| I don't understand! | Vista General | |||
| Can Someone Help me Understand? | Vista mail | |||
| I dun understand. | Vista General | |||