Timeout Msgbox popup

Gavin picture Gavin · Apr 29, 2014 · Viewed 28.9k times · Source

I have a small script that runs (basically fires a msgbox to tell people that their account passwords are about to expire).

I want it to close itself after say 30 minutes, but cannot get the syntax right to do it, can anyone help?

Below is the section that calls the msgbox

if (daysLeft < warningDays) and (daysLeft > -1) then

Msgbox "Your Password Expires in " & daysLeft & " day(s)" & " at " & whenPasswordExpires & chr(13) & chr(13) & "Please ensure that you change your password before" & chr(13) & "its expiry time to prevent any disruption of service.", 4144, "PASSWORD EXPIRATION WARNING!"

End if

--

Gavin.

Answer

Bond picture Bond · Apr 29, 2014

The Popup() method of the WShell object can timeout after a specified number of seconds. Here's an example that should disappear after 30 minutes.

CreateObject("WScript.Shell").Popup "Hello!", 1800, "Title"