tags:

views:

20

answers:

2

Hi I have VB script that run second VB script The second VB script ask some questions from the input box My problem is that “MyShell.Run” not wait until SecondVBscript.vbs will ended And the Other VB syntax run immodestly also

Need to wait for MyShell.Run process ended and then perform the Other VB syntax How can I do that?

Set MyShell = Wscript.CreateObject("WScript.Shell")

MyShell.Run " C:\Program Files\SecondVBscript.vbs"

Set MyShell = Nothing

Other VB syntax

A: 

If I get you correctly, you can make your script wait at certain point using sleep method of WScript object:

MyShell.Sleep(12000) 
Sarfraz
sorry but its not agood solution , I must to wait until script endedand then cont
yael
@yael: Script ends only when vbs parser reads the last line of the script. You can decide for yourself now :)
Sarfraz
A: 

The Run method has an optional argument bWaitOnReturn, if you set that to true, won't it wait then? See here for the documentation of the Run command.

ho1
please give me relevant example in order to put it in the scriptthxyael
yael
ho1
I don’t understand the notepad in the syntaxyael
yael
@yael: It's part of a sample that will open notepad. For you it should probably be like `MyShell.Run ("C:\Program Files\SecondVBscript.vbs", 1, true)`.
ho1