mjg Posted May 10, 2007 Share Posted May 10, 2007 I have two (hopefully) quick questions: 1: Is it possible to have the SplashTextOn display a variable? (See code below) 2: Is it possible to send keys to an application if the windows session is locked via ctrl-alt-del, 'lock computer'? Here is my code (this is only my second day w/ scripting so forgive the crude code): expandcollapse popup;AutoIt Script to log users off of TMS AutoItSetOption("WinTitleMatchMode", 2) ;How many times to hit 'Escape' if TMS is open $esctry = 10 ;How many minutes until logoff procedure begins $time = 10 Do If WinActivate("TMS_WS", "") Then SplashTextOn ( "CTMS Logout", "You will be logged out of TMS in %$time% minutes; please log off now!!!!!") sleep (5000) SplashOff ( ) Else MsgBox(0, "Thank You,", "Thank you for logging off of TMS!" ) Exit EndIf Sleep (55000) $time = $time - 1 Until $time = 0 SplashTextOn ( "CTMS Logout", "You are now being logged out of CTMS. Do not use your computer at this time.") Do If WinActivate("TMS_WS", "") Then sleep (200) ControlSend ( "TMS_WS", "", "", "{esc}" ) sleep (1000) Else SplashOff ( ) MsgBox (0, "Logged Off", "You have been logged off of TMS by the system" ) Exit EndIf $esctry = $esctry + 1 Until $esctry = 0 SplashOff ( ) Exit Link to comment Share on other sites More sharing options...
erebus Posted May 10, 2007 Share Posted May 10, 2007 1) SplashTextOn ( "CTMS Logout", "You will be logged out of TMS in " & $time & " minutes; please log off now!!!!!") The same trick works virtually on any AutoIT function. 2) Haven't tested it, but you may if you like. It's not difficult. Link to comment Share on other sites More sharing options...
mjg Posted May 10, 2007 Author Share Posted May 10, 2007 (edited) Thanks the & $time & worked great! As far as my second question, what I meant to say was that the 'ControlSend' doesn't seem to work properly when the computer is locked by the user. At least the way I have it setup, currently. Are there any other options for sending key strokes to an application while the desktop is locked? Thanks again, Edited May 10, 2007 by mjg Link to comment Share on other sites More sharing options...
erebus Posted May 10, 2007 Share Posted May 10, 2007 I don't think so. Actually the only way of sending something is via Send(), ControlSend() etc. I don't have the time to test your code ATM; maybe someone else can help you with this. Link to comment Share on other sites More sharing options...
mjg Posted May 10, 2007 Author Share Posted May 10, 2007 Or if there is even a better solution for doing this. Basically it goes through the first part of the script fine, then it pauses to send the key strokes until the computer is unlocked. Once it is unlocked, it finishes the script fine. -mjg Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now