?
Solved

Need to write VBScript for a timer Message Box

Posted on 2006-11-06
7
Medium Priority
?
3,047 Views
Last Modified: 2010-07-07
Hi Everyone...
I am in the middle of writing a Startup VBScript, inside this script there is an "if condition statement"...
When the “if statement” is true a message box should be appeared and closed automatically.
The question is:
How can I make an auto close message box that will be closed after 15 seconds?
Thanks a lot....

0
Comment
Question by:alkhaleej
7 Comments
 
LVL 35

Accepted Solution

by:
mvidas earned 2000 total points
ID: 17880840
Hi alkhaleej,

The wscript shell object has a .Popup method which closes after a specified amount of time.  An example for 15 seconds:

 Dim Wshell
 Set Wshell = CreateObject("wscript.shell")
 Wshell.Popup "Timed popup!", 15, "Popup title"
 Set Wshell = Nothing

After the Title argument there is also a Type argument, like msgbox, in case you want to ask the user about a yes/no/abort/ignore/etc, which can also return if the user actually clicked something or let the popup time out.  Check out the Popup method on msdn for more info (or just ask).

Matt
0
 

Author Comment

by:alkhaleej
ID: 17887552
thanks it is working
0
 
LVL 35

Expert Comment

by:mvidas
ID: 17889225
Glad to help! Let me know if you need anything else
Matt
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Expert Comment

by:grfxguy
ID: 23635559
Simple, elegant, and it works like a charm. Once again EE comes to the rescue.

Now, to make it absolutely perfect for my needs, is there a way to get the popup to display the drive letter string values that were entered earlier in the script?

Option Explicit
Dim objNetwork, strRemotePath1, strRemotePath2, strRemotePath3, strRemotePath4
Dim strDriveLetter1, strDriveLetter2, strDriveLetter3, strDriveLetter4

strDriveLetter1 = "S:"
strDriveLetter2 = "T:"
strDriveLetter3 = "U:"
strDriveLetter4 = "V:"

strRemotePath1 = "\\CFOTech-FS1\Data\QuickBooks"
strRemotePath2 = "\\CFOTech-FS1\Data\Miscellaneous"
strRemotePath3 = "\\CFOTech-FS1\Data\Pensoft"
strRemotePath4 = "\\CFOTech-FS1\Data\Lacerte"

Set objNetwork = CreateObject("WScript.Network")

' Section which maps four drives, S:, T:, U:, and V:
objNetwork.MapNetworkDrive strDriveLetter1, strRemotePath1
objNetwork.MapNetworkDrive strDriveLetter2, strRemotePath2
objNetwork.MapNetworkDrive strDriveLetter3, strRemotePath3
objNetwork.MapNetworkDrive strDriveLetter4, strRemotePath4


' Extra code to add a message box
Dim Wshell
Set Wshell = CreateObject("WScript.shell")
' Wshell.Popup "Mapped drives ""strDriveLetter1", "strDriveLetter2", "strDriveLetter3" & "strDriveLetter4"",7, "Drives mapped"
Wshell.Popup "Mapped drives S:, T:, U:, & V:.",7, "Drives mapped"
Set Wshell = Nothing

Wscript.Quit

If I use the first Wshell.Popup line, I get an error "Expecting conclusion". I have tried numerous combinations and placements of the quote marks, but it just moves the error to a different character on the same line. What am I doing wrong?

Thanks
Nick
0
 
LVL 35

Expert Comment

by:mvidas
ID: 23635635
Hi Nick,

Generally, you should open a new question by clicking the "ask a related question" link near the comment box.  However, I'm happy to answer this here right now as I only have a minute and this should only take a minute.

What you'll want to use is:

Wshell.Popup "Mapped drives " & strDriveLetter1 & ", " & strDriveLetter2 & ", " & strDriveLetter3 & " & " & strDriveLetter4 & ".", 7, "Drives mapped"

You just had to add the & symbol to concatenate strings together (to put the comma after the drive letters).

Cheers
0
 

Expert Comment

by:grfxguy
ID: 23638167
Thanks so much for you very prompt answer. I had tried something similar, but didn't quite have the syntax right. Your line worked perfectly.
0
 
LVL 1

Expert Comment

by:xEr72
ID: 33153867
Appreciate the post.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The main intent of this article is to make you aware of ‘Exchange fail to mount’ error, its effects, causes, and solution.
There can be many situations demanding the conversion of Outlook OST files to PST format and as such, there is no shortage of automated tools to perform this conversion. However, what makes Stellar OST to PST converter stand above the rest? Let us e…
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question