Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Message box.

Status
Not open for further replies.

draylan

IS-IT--Management
Jul 29, 2004
54
SG
Hello,

I am trying to display a message box saying something like "Configuring... please wait." But I would like to have NO buttons for the user to click on... just an information box. All I've found were code with buttons. Is there a way to get rid of the OK button? Here's the code i have:

========================================================
Button = -1
Set WshShell = WScript.CreateObject("WScript.Shell")
Button = WshShell.Popup("Configuring... Please wait.", 30, "Configuring...", 64)
========================================================

I know the 64 code means 0+64 (0 being the OK button and 64 being the Information icon). I would like to remove the OK button.

Thanks in advance!

Dave
 
Why don't you want buttons?

if you're trying to display a please wait message, why not just do it in the browser?

For the effect you want, you'd have to open a new window.
 
VBScript doesn't necessarily need the browser to be up at all so using the browser may not be ideal either. You could look at something like JProgBar (Google it).

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Hello draylan,

Do this?
[tt]
Button = WshShell.Popup("Configuring... Please wait.", 30, "Configuring...", [blue]63[/blue])
[/tt]
regards - tsuji
 
Hi,

Thanks for your responses...

Nevermoor -- I don't want any buttons because the window closes itself and i need it to stay up for 30 seconds without interruption. If they click OK it will close and the rest of the script will continue.

Tsuji -- I tried it with the 63 but when i tried to execute the script... nothing happens. ??


Thanks,

Dave
 
draylan,

>nothing happens
??? I get the exact functionality you request.

- tsuji
 
Hi Tsuji,

What am I doing wrong? I pasted my code below:

Button = -1
Set WshShell = WScript.CreateObject("WScript.Shell")
Button = WshShell.Popup("Configuring... Please wait.", 30, "Configuring...", 63)


When I double-click on the script nothing seems to happen... not even an error message. Is it supposed to give me a window saying "Configuring... Please wait." and no buttons?

Thanks.
 
Tsuji, I get the same behavior as draylan.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Hi draylan and TomThumbKP,

I am positive. I will look into it.

- tsuji
 
Further note:

It won't do on a NT box!

- tsuji
 
draylan,

I briefly scan ng for this topic, there are suggestion of using internet.application to simulate it. This is the main stream without using small activex specifically made for this.

My own idea for a solution is that you can make a loop controling the whole period you want to disabling client-intervention. Within the loop, if you detect the popup button being clicked (your return value button), you spawn another popup rightaway with the time remaining. Whereas, the main time control is still the hidden time-difference calculation. Once time's up, the loop retires. This would be the cheapest and universal over windows platform and to me no less "elegant" (I tend to be pragmatic). No ie, no other helper controls...

- tsuji
 
drylan,

This is what I would propose doing. The script is self-explanatory enough. Only point is the idea of using ok button productive/positive instead of negative (like do not click the button...!)
Code:
call popup(60)	'in second

sub popup (waittime)		'waittime in second

	sTitle="Configuring... Estimated time needed " & waittime & " seconds."
	sMsg="If you want to check remaining time, please press OK." & vbcrlf

	set wshshell=createobject("wscript.shell")
	remaintime=waittime : starttime=now
	do while ibutton<>-1 and remaintime>0
		ibutton = WshShell.Popup(sMsg, remaintime, sTitle, 64-0)
		remaintime=waittime-datediff("s",starttime,now)
		if ibutton<>-1 then
			sMsg=sMsg & vbcrlf & "Latest time remaining check : "& remaintime & " seconds left."
		end if
	loop
	sTitle="Configuring is completed."
	sMsg="Thank you for your patience."
	ibutton = wshshell.popup(sMsg, 2, sTitle, 64-0)
	set wshshell=nothing
end sub
(As the message and title are scripted in the sub, if you want more flexibility, de-modularize it.)

- tsuji
 
Hi,

Wow that's a great idea... thanks so much for your help tsuji. And thanks TomThumbKP for your help too. I'll give this a try.

-draylan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top