Re: Running VBScript code asynchronously?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Could the SWBem SINK Object accomplish an async-ish script?


"Leslie Houk" <lhouk@xxxxxxx> wrote in message
news:1118868895.101551.320900@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thanks for the ideas, Csaba. I borrowed from your AsyncPopup
> subroutine and came up with the following (using the same example as in
> my initial post):
>
> strMsgBoxFile = "\TempMsgBox.vbs"
> Set objMsgBoxFile = objFileSys.CreateTextFile( strMsgBoxFile, Overwrite
> )
> objMsgBoxFile.WriteLine( "MsgBox " & Chr(34) & "First line" & Chr(34) )
> objMsgBoxFile.Close
> Set objMsgBoxFile = Nothing
> objWShell.Run "cscript.exe " & strMsgBoxFile, 0
> Set objMsgBoxFile = objFileSys.GetFile( strMsgBoxFile )
> On Error Resume Next
> objMsgBoxFile.Delete Force
> On Error Goto 0
> Set objMsgBoxFile = Nothing
> MsgBox "Second line"
>
> I write out a temporary .vbs file with the first MsgBox command,
> execute the file with WShell.Run, and then delete it. Frankly, it's
> not the most elegant code I've written, but it does what I want.
>


.