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!

Full of problems today :) help with CreateObject("WScript.Shell")

Status
Not open for further replies.

WilliamUT

IS-IT--Management
Oct 8, 2002
182
US
Im trying to make my shell wait until an applications is done running. i thought there was a command called .bwaitonreturn=true but my script doesnt seem to like that :

Function InstallApp(Path) 'this shells and runs an application (our executables)
Dim WshShell

Set WshShell = CreateObject("WScript.Shell")


On Error Resume Next

wshshell.bWaitOnReturn = true
WshShell.Run Path

if err.number <> 0 THEN
msgbox &quot;There was an error running a command.&quot; & vbcrlf & _
&quot;Error : &quot; & err.number & vbcrlf & _
&quot;Description : &quot; & err.description & vbcrlf & _
&quot;Command : &quot; & Path, vbcritical, &quot;Error&quot;
oform.hide
oform = nothing
wscript.quit
end if


end function


how do i get my script to take a break and wait until the application is closed?
 
nevermind d'uh

WshShell.Run <path>,<windowmode>,<waitonreturn>
 
WilliamUT,

Set WshShell = WScript.CreateObject(&quot;WScript.Shell&quot;)
Return = WshShell.Run(&quot;notepad &quot; & WScript.ScriptFullName, 1, true)

true allows it to wait unti execution is done.

fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top