Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Run WaitOnReturn

91 views
Skip to first unread message

htran

unread,
Feb 21, 2005, 3:59:37 PM2/21/05
to
I am using the run command in VBScript to call a Visual Basic 6.0
executable. And, I would like to verify if the setting of WaitOnReturn
to True allows the VB6.0 executable to be completed in its entirety
before the VBScript continues with the next line. The intention is to
find a way to have the VBScript runs in a single thread mode and wait
on the completion of any program executable before returning to the
next step in the script. I would greatly appreciate any comments and
suggestions. Thank you.

Joe McMillan

unread,
Feb 21, 2005, 4:46:10 PM2/21/05
to
>And, I would like to verify if the setting of WaitOnReturn
>to. True allows the VB6.0 executable to be completed in its entirety

>before the VBScript continues with the next line.

It will wait for the exe to complete - It will even wait on processes that
the exe waits on. For example. running a batch file will cause the script
to wait on the entire batch file to complete.

FROM SCRIPT DOC:
bWaitOnReturn
Optional. Boolean value indicating whether the script should wait for the
program to finish executing before continuing to the next statement in your
script. If set to true, script execution halts until the program finishes,
and Run returns any error code returned by the program. If set to false (the
default), the Run method returns immediately after starting the program,
automatically returning 0 (not to be interpreted as an error code).


Michael Harris (MVP)

unread,
Feb 21, 2005, 4:52:58 PM2/21/05
to

The WaitOnReturn argument works as expected for VB6 EXEs. Note that VB6
EXEs have no native abilty to return process exit codes, so the return value
from the Run method has no meaning for a VB EXE.


--
Michael Harris
Microsoft MVP Scripting
http://maps.google.com/maps?q=Sammamish%20WA%20US


htran

unread,
Feb 21, 2005, 4:57:34 PM2/21/05
to
Thanks for the response. Do you know if there is a way to diable the
WindowStyle parameter? In my testing, it seems that the run command
would bring up the VB6 form. Then, upon the closing of the form
window, the script does continue with the next statement. However,
since our VB6 programs are mainly batch processing, this present a
problem in that we have to close these form windows. Please let me
know.

Michael Harris (MVP)

unread,
Feb 21, 2005, 6:28:22 PM2/21/05
to


VB6 is a bad choice for EXEs meant for unattended automation since it does
not support creating true console applications. A VB6 COM component is
better. If you must use VB6 EXEs, write formless apps (startup is Sub
Main(), not a form). If you do, then make 100% sure the app never leaks
unhandled runtime errors or you'll get a VB runtime error dialog which you
may not even be able to see, depending on the environment in which the app
is executed.

VB.Net or C# or JScript.Net is a far better language choice since all
support true console apps.

htran

unread,
Feb 22, 2005, 11:37:25 AM2/22/05
to
It turns out that the reason for the display of the VB6 form is due to
the form not being unloaded in the VB6 program. So, as you had
indicated, the WaitOnReturn does return to the next script statement
after the completion of the VB6 program. Thanks again for the
response.
0 new messages