Link to home
Start Free TrialLog in
Avatar of alkhaleej
alkhaleej

asked on

Need to write VBScript for a timer Message Box

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

ASKER CERTIFIED SOLUTION
Avatar of mvidas
mvidas
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alkhaleej
alkhaleej

ASKER

thanks it is working
Glad to help! Let me know if you need anything else
Matt
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
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
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.
Appreciate the post.