smatty Posted January 15, 2012 Share Posted January 15, 2012 (edited) I wrote an AutoIt backup script that ran flawlessly for 5+ years, but has recently started failing. The failure occurs when calling WinActivate() to bring the server application to the foreground in preparation for shutdown. I am using remote desktop to connect to the server (mstsc.exe /admin) as close to the "real" console session as possible. If I manually run the script while connected via remote desktop, it works correctly. If I schedule the script, disconnect from remote desktop, and check back later, the server application window has been maximized, but doesn't have focus, causing the script to fail gracefully. I have read that the root cause of the issue is that Windows shuts down GUI interaction with application windows if nobody is connected to the session. I have tried everything I can think of (various hacky combinations of sleep(), sending multiple WinActivate(), trying ControlSend() so the window doesn't need to be active first), but nothing works. I see various people reporting similar problems around the internet (both with AutoIt and other products), but nobody seems to have a solution. Does anybody here know workarounds for this issue? Thank you Smatty Edited January 15, 2012 by smatty 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