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.

有帮助吗?

解决方案

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"

其他提示

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!

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top