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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

message box timer

Status
Not open for further replies.

Briandr

MIS
Jul 11, 2003
177
US
Hi,

How could I adjust this code so that a prompt will reappear every 2 hours if No is clicked?

Set wshshell = CreateObject("Wscript.Shell")
intMessage = Msgbox("MIS has updated your computer to IE7. A restart is required to complete the installation. Would you like to restart now?",_
vbYesNo, "ABC - Internet Explorer 7 Upgrade")
If intMessage = vbYes Then
WshShell.Run "%windir%\system32\shutdown.exe -r -t 300 -c " & chr(34) &_
"Internet Explorer 7 Upgrade - Please save and close your work as the computer will be restarted in 5 minutes." & chr(34)
Else
Wscript.Quit
End If
 
simply..

Code:
[red]do[/red]
   Set wshshell = CreateObject("Wscript.Shell")
   intMessage = Msgbox("MIS has updated your computer to IE7. A restart is required to complete the installation. Would you like to restart now?",_vbYesNo, "ABC - Internet Explorer 7 Upgrade")

   If intMessage = vbYes Then
      WshShell.Run "%windir%\system32\shutdown.exe -r -t 300 -c " & chr(34) &_"Internet Explorer 7 Upgrade - Please save and close your work as the computer will be restarted in 5 minutes." & chr(34)
   Else
      Wscript.[red]sleep 7200000 '2 hours in millisecs[/red]
   End If 
[red]loop[/red]

although, I not sure what resource cost would be. Might want to use a smaller number (30000, 30 secs) and check the CPU usage in task manager to make sure the write isn't hogging it all.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Hi,

Thanks for the reply. Can you tell me if I have this sectioned off correctly where the looping needs to be done? I think I do, but am not sure.

Set wshshell = CreateObject("Wscript.Shell")
WshShell.CurrentDirectory = "C:\Program Files\Altiris\Altiris Agent\Agents\SoftwareManagement\Software Delivery\{A34884B7-C69B-4E6F-9E86-02F852CABBEC}\cache"
wshshell.run "IE7Setup.exe"
wscript.sleep 360000
do
intMessage = Msgbox("MIS has updated your computer to IE7. A restart is required to complete the installation. Would you like to restart now?",_vbYesNo, "ABC - Internet Explorer 7 Upgrade")
If intMessage = vbYes Then
WshShell.Run "%windir%\system32\shutdown.exe -r -t 300 -c " & chr(34) &_"Internet Explorer 7 Upgrade - Please save and close your work as the computer will be restarted in 5 minutes." & chr(34)
Else
Wscript.sleep 7200000 '2 hours in millisecs
End If
loop
 
It looks right. Next time you post code, please do so within [ignore]
Code:
[/ignore] tags to preserve formatting.

Also, I would look into checking the processes to determine when IE7Setup.exe finishes instead of waiting for 6 minutes (wscript.sleep 360000). Some slower machnine may take longer than 6 minutes

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Hi,

All appears well with the exception of one thing. When I click yes the message box does close. Instead the shutdown window opens on top of the message box. Is there any easy way to fix this? Thanks for the help.
 
The loop is continuing because there is no . Change the loop it to be

Code:
loop until (intMessage = vbYes)

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top