JohnTWI Posted May 29, 2020 Share Posted May 29, 2020 I am running a script on a windows server with the remote desktop closed and the script started via an AutoIt Console App The script runs fine all day but at 2:00 in the morning the GUI application is stopped for nightly processing. I am able to pause the script and restart the GUI and the autoit script runs fine, but after the GUI is restarted when it reaches the WinGetTitle code it never finds the Open Active Window ( and I verified the document is open) Example of code below: Local $sText = WinGetTitle("[ACTIVE]") ; Retrieve the window title of the active window. Thank you in advance Link to comment Share on other sites More sharing options...
faustf Posted May 30, 2020 Share Posted May 30, 2020 18 hours ago, JohnTWI said: Local $sText = WinGetTitle("[ACTIVE]") ; Retrieve the window title of the active window. usually Retrieves the full title from a window. WinGetTitle ( "title" [, "text"] ) Parameters title The title/hWnd/class of the window to get the title. See Title special definition. text [optional] The text of the window to get the title. Default is an empty string. See Text special definition. where is your hWnd in your code ? find with au3info tools and give it Link to comment Share on other sites More sharing options...
mikell Posted May 30, 2020 Share Posted May 30, 2020 20 hours ago, JohnTWI said: it never finds the Open Active Window ... or the currently active window has no title. Using [ "active"] can be tricky Link to comment Share on other sites More sharing options...
HansHenrik Posted May 30, 2020 Share Posted May 30, 2020 (edited) i had problems with AutoIt scripts behaving... badly, whenever i disconnected from a Remote Desktop session on a... i think it was "Windows Server 2012 R2"? (possibly Windows Server 2016) i solved it by using SysInternals Autologon utility from https://docs.microsoft.com/en-us/sysinternals/downloads/autologon making the system automatically login on the administrator account on reboot, then rebooting, and switching from Remote Desktop to TeamViewer... after that, i had no more issues from disconnecting =/ Edited May 30, 2020 by HansHenrik Link to comment Share on other sites More sharing options...
JohnTWI Posted May 31, 2020 Author Share Posted May 31, 2020 On 5/30/2020 at 8:26 AM, HansHenrik said: i had problems with AutoIt scripts behaving... badly, whenever i disconnected from a Remote Desktop session on a... i think it was "Windows Server 2012 R2"? (possibly Windows Server 2016) i solved it by using SysInternals Autologon utility from https://docs.microsoft.com/en-us/sysinternals/downloads/autologon making the system automatically login on the administrator account on reboot, then rebooting, and switching from Remote Desktop to TeamViewer... after that, i had no more issues from disconnecting =/ HansHenrik Question if I connect to the server via TeamViewer and then submit a script and then disconnect from Team Viewer the script should continue without any issues? Thank you in advance for your response. Link to comment Share on other sites More sharing options...
HansHenrik Posted June 1, 2020 Share Posted June 1, 2020 20 hours ago, JohnTWI said: HansHenrik Question if I connect to the server via TeamViewer and then submit a script and then disconnect from Team Viewer the script should continue without any issues? Thank you in advance for your response. correct. but i can't say the same for Windows's Remote Desktop Connection, disconnecting from RDC caused problems with running AutoIt scripts for me, but disconnecting from TeamViewer didn't cause any problems Link to comment Share on other sites More sharing options...
JohnTWI Posted June 1, 2020 Author Share Posted June 1, 2020 On 5/30/2020 at 6:32 AM, mikell said: ... or the currently active window has no title. Using [ "active"] can be tricky Yes after I restart the GUI the open "Active" window is never found again, Link to comment Share on other sites More sharing options...
mikell Posted June 1, 2020 Share Posted June 1, 2020 Does your gui have a title ? Link to comment Share on other sites More sharing options...
JohnTWI Posted June 2, 2020 Author Share Posted June 2, 2020 On 5/30/2020 at 6:32 AM, mikell said: ... or the currently active window has no title. Using [ "active"] can be tricky 20 hours ago, mikell said: Does your gui have a title ? Yes CPSI, the application is recycled nightly, After restarting the gui application I go to a document view in the gui and open a document in the view, when the document opens that's when the WinGetTitle fails. Works fine until the gui application is recycled, my script is also running in console mode started via Remote Desktop. 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