Question

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.

Was it helpful?

Solution

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"

OTHER TIPS

You wont be able to do it that way, you will need to use your own custom form and timer, because a message box can only close on user interaction.

echoing the point made by @user3585329, to do this you may want to create a HTA application, which can display the information in a internet explorer form.

FIX that like this:

CreateObject("WScript.Shell").Popup "MessageHere", 10, "Title"

TimeOut is in SECONDS, not in miliseconds!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top