popup msg should wait for answer

February 14, 2009 at 10:55:56
Specs: Windows XP
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)


See More: popup msg should wait for answer

Report •


#1
February 15, 2009 at 00:11:17
intReturn = objShell.Popup(msg, 5, "s/w update",64)
...will wait for 5 seconds. (The return on timeout is -1.)

Report •

#2
February 15, 2009 at 23:30:57
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.


Report •

#3
February 15, 2009 at 23:38:13
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'")


Report •

Related Solutions

#4
February 16, 2009 at 00:07:39
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?


Report •

#5
February 16, 2009 at 05:42:40
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 if

refer to http://msdn.microsoft.com/en-us/lib... for programming reference


Report •

#6
February 16, 2009 at 05:51:43
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

Report •

#7
February 16, 2009 at 23:11:49
>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'")


Report •

#8
February 17, 2009 at 05:48:20
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
next

and NO, i dont know how you are going to use the above script to run asynchronous popup msg without starting another vbs process.


Report •

#9
February 20, 2009 at 03:43:29
>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.


Report •


Ask Question