Link to home
Start Free TrialLog in
Avatar of Mack
MackFlag for United States of America

asked on

vbs script that loops every 15 minutes until "OK" pressed

Greetings .VBS script guru's!

I'm trying to write a FOR loop that continually loops every 15 minutes (in the background) until the user clicks the "OK" button. If the user clicks the "cancel" button, then the VBS script will run in the backgroup and pop-up again every 15 minutes until the user clicks the "OK" button (which then performs an action). I've tried a DO, and WHILE and a FOR loop, without any success.

Any ideas how I could accomplish this?

Thank you so much for your expert assistance!

-Mac
Avatar of Bill Prew
Bill Prew

So, for the 15 minutes of background processing you don't want anything on screen, right?

And then, each 15 minutes you will ask what they want to do, Okay to exit, or Cancel to go back to background mode?

How long do you want this choice dialog to stay visible?  Since it is a blocking even your script can't do anything else until they decide, so how long to you want to give them?

And what if they don't click a button, but rather that dialog times out after say 30 seconds.  What should the path be then?


»bp
And is this really VBScript, or something else, like VB or VB Classic, etc?


»bp
Avatar of Mack

ASKER

Hi Bill

Thank you for your reply.

It's a script .vbs that runs on Windows 7 PC.

To answer your questions:

<<So, for the 15 minutes of background processing you don't want anything on screen, right?>>

Correct. Nothing on the screen, so that they can continue to work uninterrupted.

 <<And then, each 15 minutes you will ask what they want to do, Okay to exit, or Cancel to go back to background mode?>>

Yes, exactly. the pop-up will happen again and they have a choice of "OK" or "CANCEL". If they click "OK", then it performs an action. If they click "cancel" it goes into background mode again, waiting another 15 minutes to pop-up again.

<< How long do you want this choice dialog to stay visible? >> 

It should stay always stay visible until which time they either choose "OK" or "CANCEL"

<<Since it is a blocking even your script can't do anything else until they decide, so how long to you want to give them?>>

They have forever to decide, until which time they either click "OK" or "CANCEL", to move on.

<< And what if they don't click a button, but rather that dialog times out after say 30 seconds.  What should the path be then?>>

The pop-up dialog should not time out. I should stay up on their screen until they choose "OK" or "cancel", so it forces them to make a decision or they can't continue to work.

Thank you very much, Bill for your help with this!

-Mac
Option Explicit

Dim Message

Do Until Message = vbOk 
    Message = MsgBox("Test",vbOKCancel,"Test")
    WScript.Sleep 900000
Loop 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

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 Mack

ASKER

Thank you very much! Trying it today. Will let you know how it works ASAP.
Avatar of Mack

ASKER

Outstanding. I'm good, but you blow me away. Great! Thank you!