Computing.Net > Forums > Programming > popup msg should wait for answer

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

popup msg should wait for answer

Reply to Message Icon

Name: chprakashs
Date: February 14, 2009 at 10:55:56 Pacific
OS: Windows XP
Subcategory: General
Comment:

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)



Sponsored Link
Ads by Google

Response Number 1
Name: Razor2.3
Date: February 15, 2009 at 00:11:17 Pacific
Reply:

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


0

Response Number 2
Name: chprakashs
Date: February 15, 2009 at 23:30:57 Pacific
Reply:

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.


0

Response Number 3
Name: chprakashs
Date: February 15, 2009 at 23:38:13 Pacific
Reply:

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'")


0

Response Number 4
Name: Razor2.3
Date: February 16, 2009 at 00:07:39 Pacific
Reply:

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?


0

Response Number 5
Name: reno
Date: February 16, 2009 at 05:42:40 Pacific
Reply:

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


0

Related Posts

See More



Response Number 6
Name: Razor2.3
Date: February 16, 2009 at 05:51:43 Pacific
Reply:

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


0

Response Number 7
Name: chprakashs
Date: February 16, 2009 at 23:11:49 Pacific
Reply:

>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'")


0

Response Number 8
Name: reno
Date: February 17, 2009 at 05:48:20 Pacific
Reply:

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.


0

Response Number 9
Name: chprakashs
Date: February 20, 2009 at 03:43:29 Pacific
Reply:

>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.


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: popup msg should wait for answer

MAKE DOS WAIT FOR REPLY B4 EXECUTING www.computing.net/answers/programming/make-dos-wait-for-reply-b4-executing/426.html

What OS is best for C++ ? www.computing.net/answers/programming/what-os-is-best-for-c-/17002.html

PHP/MySQL question www.computing.net/answers/programming/phpmysql-question/9309.html