Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have a VB script which pops up a message to user with OK button and it waits for result and doesn't exceute the rest of the code untill user responds. I need to change the code to not wait for user response and just popup a msg box and proceed with executing the rest of the code.intReturn = objShell.Popup(msg, , "s/w update",64)

intReturn = objShell.Popup(msg, 5, "s/w update",64)
...will wait for 5 seconds. (The return on timeout is -1.)

I dont want to time out the msg box but leave it like that till user see that message. At the same time I want to execute the rest of the code irrespective of the return code.
Sine a msg with OK button is just a information message am assuming there should be a way to not wait for response from user.
Calling another vbs within this scrip and and popping up msg is not feasible for me considering the environment I'm dealing with.

I searched through internet and looks niether msgbox or popup method has a way to ignore the return code.
I have another thought. I would like to check for the existence of a particular process from a script and act accordingly. I have the below code to query the process running but how to identify the source of the process? (i.e. wscript.exe from which script) etc.. Let meknow if you have any idea.
Set objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'WSCRIPT.EXE'")

I dont want to time out the msg box but leave it like that till user see that message. At the same time I want to execute the rest of the code irrespective of the return code.
That would require multiple threads, and VBScript is only a single threaded.how to identify the source of the process?
Like what? the parent process?

shell.run() had similar behaviour like a thread. it open a new window process, similar to "start" in dos cmd.
Set ws = CreateObject("Wscript.Shell") if wsh.arguments.count=0 then ws.run """" & wscript.scriptfullname & """ asynchronus",1, false ws.run """" & wscript.scriptfullname & """ process",1, false ws.run """" & wscript.scriptfullname & """ test",1, false else ws.popup wsh.arguments(0),,"test",64 end ifrefer to http://msdn.microsoft.com/en-us/lib... for programming reference

Yeah, he already shot that one down, reno.
chprakashs: Calling another vbs within this scrip and and popping up msg is not feasible for me

>Like what? the parent process?
Am assuming there is a way to find out if there is process running and what is the source of the process. For example, a script summary.vbs is poping up a message then there should be a way to query the wscript.exe spawned by summary.vbs script with some modifications to the below code.et objShell = CreateObject("Wscript.Shell")
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = 'WSCRIPT.EXE'")

how to identify the source of the process? (i.e. wscript.exe from which script) etc. Am assuming there is a way to find out if there is process running and what is the source of the process.
YES, you can. continuing your above script
for each o in colProcesses if instr(o.commandline, wscript.scriptname) > 0 then wsh.echo "FOUND=" & o.commandline end if nextand NO, i dont know how you are going to use the above script to run asynchronous popup msg without starting another vbs process.

>and NO, i dont know how you are going to use the above script to run asynchronous popup msg without starting another vbs process.
I didn't try it but we can use psexec.exe to start a new process and give a pop up and continue with the the rest of the code of the original script. may be it works.
Thanks for the help, I'm done with my script.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |