Autologon timeout to lock screen again

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
dgmacro
Newbie
Posts: 2
Joined: Mon Mar 07, 2016 12:20 am

Autologon timeout to lock screen again

Post by dgmacro » Mon Mar 07, 2016 2:03 am

Hi - Is there a way to tell a script to terminate if it takes over a certain time to run ?

I have a script that uses autologon and calls a program, then waits for the window to open before continuing.
However sometimes the program errors and won't go beyond various error message screens, so the target window never opens and the script waits indefinitely.

Net result, I've come in to work to find my desktop has been unlocked for hours which is obviously a huge security issue (when the program loads correctly the script itself only unlocks for a few minutes to run at 3am which is fine).

The program is essential but a bit unstable at this time, and the error messages are random so i can't put in a simple if statement to look for the error window.

Ideally, I need a command or option that terminates the macro after e.g. 5 mins, forcing the screen to lock again.

Cheers,

Dave

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Autologon timeout to lock screen again

Post by Marcus Tettmar » Mon Mar 07, 2016 11:35 am

What you need to do is add timeouts. All the WaitWindow... commands and others let you set a timeout period. After the call, check the result to see if it timed out or not, and if it did, exit, or report, or whatever you want to do.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts