reesewon Posted October 26, 2015 Share Posted October 26, 2015 (edited) Hey there,I am very new to Autoit, so please forgive me if this is a simple issue. I have tried looking all over (forums etc.) and I cannot figure out why, but WinWaitActive stops working in my Sage50 2015 install script.Here is my code:Opt('TrayIconDebug', 1) Run ("setup.exe /S") WinWaitActive( "Installing Sage 50 Accounting Release 2015.0...", "Windows Firewall" ) ControlClick("Installing Sage 50 Accounting Release 2015.0...", "", "[CLASS:Button; INSTANCE:1]") WinWaitActive( "Installing Sage 50 Accounting Release 2015.0...", "Type of installation") ControlClick("Installing Sage 50 Accounting Release 2015.0...", "", "[CLASS:Button; INSTANCE:1]") WinWaitActive( "Installing Sage 50 Accounting Release 2015.0...", "Product installation") Send("serialnumber") ControlClick("Installing Sage 50 Accounting Release 2015.0...", "", "[CLASS:Button; INSTANCE:1]") ;License Agreement ;WinWaitActive( "Installing Sage 50 Accounting Release 2015.0...", "License Agreement") WinWaitActive( "Installing Sage 50 Accounting Release 2015.0...", "", 5) Send("{TAB 3}{SPACE}") Send("!i") WinWaitActive( "Installing Sage 50 Accounting Release 2015.0...", "Installation Finished") Send("{TAB}{SPACE}") ControlClick("Installing Sage 50 Accounting Release 2015.0...", "", "[CLASS:Button; INSTANCE:1]")It works until the License agreement. As you can see above, I was able to overcome that by just waiting for 5 seconds, although I would prefer not doing that. Then, after the install it does not recognize the Installation Finished window, despite everything being accurate in the Window Info tool. I am at a loss... Thanks! Edited October 26, 2015 by reesewon Link to comment Share on other sites More sharing options...
jdelaney Posted October 27, 2015 Share Posted October 27, 2015 (edited) Try it instead with a WinWait, and then manually activate the window. WinWait returns a handle...use that in your WinActivate directly following.I'd HIGHLY recommend not to use Send. Use ControlSetText instead. Oh, misread your code...you are probably clicking a radio or a checkbox...both of those are buttons, so use ControlClick...but keep ControlSetText in mind for future scripts.Also, if you add in error handling, you will know for certain where something is succeeding or failing. It's possible that your identifier is being found on a wrong window, so you are actually on the wrong step to what you would expect your script to be.I have lots of other suggestions to make robust code...such as looping to wait for all the states of a window prior to performing functions on them (WinGetState), and doing the same for controls as well. If you click a button that has not yet 'activated' or 'enabled' you will not actually get the click through to the app. Edited October 27, 2015 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
reesewon Posted October 27, 2015 Author Share Posted October 27, 2015 I tried WinWait and then WinActive and it is still hanging on WinWait, it is like it can't recognize the page... Here is the summary for the Window that is not working:>>>> Window <<<<Title: Installing Sage 50 Premium Accounting Release 2015.0...Class: #32770Position: 584, 322Size: 504, 436Style: 0x94C800C4ExStyle: 0x00010101Handle: 0x00080256>>>> Control <<<<Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<<Position: 874, 338Cursor ID: 0Color: 0xBA9A6F>>>> StatusBar <<<<>>>> ToolsBar <<<<>>>> Visible Text <<<<End User License Agreement forSage 50 Accounting ProductsIMPORTANT - PLEASE READ CAREFULLY ALL OF THE FOLLOWING TERMS AND CONDITIONS:license agreement blah blah blah>>>> Hidden Text <<<<The controlling language of this Agreement is EnglishHere is summary for the previous window that does work fine:>>>> Window <<<<Title: Installing Sage 50 Accounting Release 2015.0...Class: #32770Position: 584, 322Size: 504, 436Style: 0x94C800C4ExStyle: 0x00010101Handle: 0x000A03AA>>>> Control <<<<Class: Instance: ClassnameNN: Name: Advanced (Class): ID: Text: Position: Size: ControlClick Coords: Style: ExStyle: Handle: >>>> Mouse <<<<Position: 860, 338Cursor ID: 0Color: 0xD0DEEB>>>> StatusBar <<<<>>>> ToolsBar <<<<>>>> Visible Text <<<<&Next >Cancel< &BackProduct installationPlease enter the 14-character serial number provided by Sage 50 to continue your installation. If you want to try Sage 50 for 30 days, select the trial option.I have a serial number:I will install the 30-day trial version for now.->>>> Hidden Text <<<<C Now, I am wondering if it has to do with the fact that the "License Agreement" text is actually part of a radio button on the page that is not working? If so, can you use WinWait to detect a control instead? The documentation doesn't really show that as possible. By the way, the visible text that you see there is in a message box, so I assume that is why it will not recognize it? Link to comment Share on other sites More sharing options...
reesewon Posted November 6, 2015 Author Share Posted November 6, 2015 bump Link to comment Share on other sites More sharing options...
Danyfirex Posted November 6, 2015 Share Posted November 6, 2015 Hello try to use [TITLE: your title] or [CLASS_ you class] and run as Admin too.Does your code work in other machine? Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
reesewon Posted November 24, 2015 Author Share Posted November 24, 2015 Sorry for the late reply!Using [TITLE: your title] or [CLASS_ you class] worked! Thank you! Its odd how for a window that is the same as the others it is picky like that. Oh well. Link to comment Share on other sites More sharing options...
Danyfirex Posted November 24, 2015 Share Posted November 24, 2015 You're Wellcome.Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut 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