sh1n Posted March 24, 2008 Posted March 24, 2008 Hi all! Anyone knows how i can do to run a script (which uses functions like WinWaitActive) when my windows is locked? Or have better solution to the follow problem: I have a machine which several users connect using WTS. This users uses a certain program. I made a script that open that program and measures the time to open and do a certain operation. Until here its all ok. I need to call the script that i made from other machine (running a monitor tool, like nagios). - This part is OK But the problem is: If I not logged on the machine - the script dosn´t run. If I have a open session and is active on the machine It´s all Ok. but...If i have a open session but is locked, the script don´t run as the expected. He loops in the (WinWaitActive), off couse because the window is not active. Thanks for your attention. waiting for replys and sorry for my english
Swift Posted March 24, 2008 Posted March 24, 2008 You could put in the ...(im going mindblank...) that place, were you put.. (Haha got it!) Scheduled Tasks, put itself in there, then just tell it what time to run, put it whenever, and then, it will wait for windows to lock... Although, this might not work, it is a suggestion
sh1n Posted March 24, 2008 Author Posted March 24, 2008 R6V2 thanks for your reply But this is not my case. The script will run, times from times. And it is a remote machine that start the execution in the machine wich contains the script. Anyway thanks R6V2! Anyone have more ideas?
Swift Posted March 24, 2008 Posted March 24, 2008 To tell the truth, I don't know if programs can still run while the computer is locked, but maybe if they can be, have your script running in a small loop to check for keystrokes/mouse movements to signify that the computer is going to be locked, if you see that, put the program inside the main loop, that will do everything it needs to do.
spudw2k Posted April 7, 2008 Posted April 7, 2008 (edited) There is something that can allow this to happen, but I wouldn't be surprised if it's not a public method. Try hitting the Winkey+U when a workstation is locked for example. Edited April 7, 2008 by spudw2k Reveal hidden contents Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
monoceres Posted April 7, 2008 Posted April 7, 2008 R6V2 said: To tell the truth, I don't know if programs can still run while the computer is locked, but maybe if they can be, have your script running in a small loop to check for keystrokes/mouse movements to signify that the computer is going to be locked, if you see that, put the program inside the main loop, that will do everything it needs to do.Of course program can run when windows is locked, test starting audio encoding or something and lock your computer.The topic is interesting though since I too have had this problem, it seems like some function don't work properly when in locked mode. Like win functins and shutdown. Broken link? PM me and I'll send you the file!
Floutsch Posted June 19, 2008 Posted June 19, 2008 (edited) Hm... I hope I can hook to that thread as my problem seems similar and a solution to mine might be the same as one to sh1n's. I'm connecting to a server via RDP to use a certain program (for bounce handling, but that's not the point). That program runs significantly more performant when the screenlog it produces is cleared manually in regular intervals. This can be done by one mouse click and thre keystrokes. The best interval is 5 minutes and the software runs 24/7. I know it's a workaround and I know that it's obviously stupid of the program to require doing so manually, but that's the way it is. Point is that the flushing (as I call it) works perfectly on my local machine. It also works fine as long as I keep the remote desktop connection open while being logged in. But as soon as I shut down the RD the server locks itself as it's supposed to do and the flusher can't find the window. One of our technicians told me that it's a common problem that you can't "find" a window on a locked Windows station. Now I'm in need for a workaround. However, along comes the code (with some stuff Xed and Yed out) in case it helps finding a solution: AutoItSetOption("WinTitleMatchMode", 2) AutoItSetOption("RunErrorsFatal", 0) TraySetToolTip("eMail Bounce Handler AutoFlusher") ; interval between flushes in minutes $flushinterval = 5 ; tooltip for the systray icon $tooltip = "eMail Bounce Handler AutoFlusher" ; indicator strings to match the window $wintitle_XXX = "XXX-TITLE" $wintitle_YYY = "YYY-TITLE" $tab_text = "Verbindungsprotokoll in Datei ausgeben" ; =========================================================== While 1>0 If WinExists($wintitle_XXX, $tab_text) OR WinExists($wintitle_YYY, $tab_text) Then WinSetState("", $tab_text, @SW_RESTORE) WinActivate("", $tab_text) WinWaitActive("", $tab_text, 1) $size = WinGetPos("", $tab_text) $clickX = $size[0]+100 $clickY = $size[1]+300 MouseClick("left" , $clickX, $clickY) Send("^a") Send("{BACKSPACE}") WinSetState("", $tab_text, @SW_MINIMIZE) EndIf $realdelay = $flushinterval*60*1000-1 TraySetToolTip($tooltip & @CRLF & " (last flush check: " & @HOUR & ":" & @MIN & ":" & @SEC & "; interval: " & $flushinterval & " minutes)") Sleep($realdelay) WEnd Edited June 20, 2008 by Floutsch
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