Discussion:
Popup won't close automatically
(too old to reply)
Steve Ginn
2005-12-08 17:36:04 UTC
Permalink
The code:

Set WShell = CreateObject("WScript.Shell")
WShell.Popup "This is the message",5

The message pops up but doesn't close. I'm doing this in a product called
DBWorks that sez is built on MS script.

Any ideas?

Steve - Traveling Developer
mr_unreliable
2005-12-08 23:00:06 UTC
Permalink
uh-oh, wrong again!!!

Sorry, I didn't look closely enough at your code.

What I suspect is that wscript.shell is setting a timer and
waiting for a notification from the system that "time's up!".

That notification comes from processing messages in a
message loop --- BUT your app (dbWorks) may have a message
loop of its own. That may lead to a "dueling Message Loops"
situation, in that the dbWorks msg loop retrieves the "time's up!"
notification before the wscript.shell msg loop, and since the
dbWorks app is not expecting the notification it may ignore
it rather than passing it along to wscript.shell.

Just a thought...

cheers, jw
Post by Steve Ginn
Set WShell = CreateObject("WScript.Shell")
WShell.Popup "This is the message",5
The message pops up but doesn't close. I'm doing this in a product called
DBWorks that sez is built on MS script.
Any ideas?
Steve - Traveling Developer
Csaba Gabor
2005-12-20 22:08:44 UTC
Permalink
Post by mr_unreliable
uh-oh, wrong again!!!
What I suspect is that wscript.shell is setting a timer and
waiting for a notification from the system that "time's up!".
That notification comes from processing messages in a
message loop --- BUT your app (dbWorks) may have a message
loop of its own. That may lead to a "dueling Message Loops"
situation, in that the dbWorks msg loop retrieves the "time's up!"
notification before the wscript.shell msg loop, and since the
dbWorks app is not expecting the notification it may ignore
it rather than passing it along to wscript.shell.
Post by Steve Ginn
Set WShell = CreateObject("WScript.Shell")
WShell.Popup "This is the message",5
So how come the following Message Box doesn't go away if all I have is
the following two line .vbs file?
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Popup "I'm obnoxious", 3, "WScript.Shell Popup", 131120

Csaba Gabor from Vienna

billy
2005-12-11 18:56:21 UTC
Permalink
I have noticed the same thing with popup in my HTA files. Below is
sample code for TEST.HTA. Can anyone tell me why the popup launched by
clicking the button never closes? Extra bonis points for fixing it!

<HTML>
<HEAD>
<HTA:Application Applicationname="Popup Test"
</HEAD>
<!--------------------------------------------------------------------->
<SCRIPT language="VBScript">
Set WshShell = CreateObject("Wscript.Shell")

Sub window_onload
WshShell.PopUp "This one waits 2 secs.", 2
End Sub

Sub NotWorking
WshShell.PopUp "This waits forever", 2
End Sub

</SCRIPT>
<!--------------------------------------------------------------------->
<BODY style="background-color: buttonface;">
<input type="button" value="Same code" onClick="NotWorking()">
</BODY>
</HTML>
Post by Steve Ginn
Set WShell = CreateObject("WScript.Shell")
WShell.Popup "This is the message",5
The message pops up but doesn't close. I'm doing this in a product called
DBWorks that sez is built on MS script.
Any ideas?
Steve - Traveling Developer
McKirahan
2005-12-11 19:51:37 UTC
Permalink
Post by billy
I have noticed the same thing with popup in my HTA files. Below is
sample code for TEST.HTA. Can anyone tell me why the popup launched by
clicking the button never closes? Extra bonis points for fixing it!
<HTML>
<HEAD>
<HTA:Application Applicationname="Popup Test"
</HEAD>
<!--------------------------------------------------------------------->
<SCRIPT language="VBScript">
Set WshShell = CreateObject("Wscript.Shell")
Sub window_onload
WshShell.PopUp "This one waits 2 secs.", 2
End Sub
Sub NotWorking
WshShell.PopUp "This waits forever", 2
End Sub
</SCRIPT>
<!--------------------------------------------------------------------->
<BODY style="background-color: buttonface;">
<input type="button" value="Same code" onClick="NotWorking()">
</BODY>
</HTML>
[snip]

Neither box closes after two seconds.

".Popup" in an HTA is not the same as under WSH.

Sort of like ".Sleep" which is only supported under WSH.
Me
2005-12-12 21:05:36 UTC
Permalink
Steve try this. This works for me.

Const TIMEOUT = 2
Set objShell = WScript.CreateObject("WScript.Shell")

objShell.Popup "This is the message", TIMEOUT

-Me
Post by Steve Ginn
Set WShell = CreateObject("WScript.Shell")
WShell.Popup "This is the message",5
The message pops up but doesn't close. I'm doing this in a product called
DBWorks that sez is built on MS script.
Any ideas?
Steve - Traveling Developer
Continue reading on narkive:
Loading...