Jump to content

Winwaitactive stops working


 Share

Recommended Posts

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 by reesewon
Link to comment
Share on other sites

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 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

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: #32770
Position: 584, 322
Size: 504, 436
Style: 0x94C800C4
ExStyle: 0x00010101
Handle: 0x00080256

>>>> Control <<<<
Class: 
Instance: 
ClassnameNN: 
Name: 
Advanced (Class): 
ID: 
Text: 
Position: 
Size: 
ControlClick Coords: 
Style: 
ExStyle: 
Handle: 

>>>> Mouse <<<<
Position: 874, 338
Cursor ID: 0
Color: 0xBA9A6F

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
End User License Agreement for
Sage 50 Accounting Products

IMPORTANT - PLEASE READ CAREFULLY ALL OF THE FOLLOWING TERMS AND CONDITIONS:
license agreement blah blah blah

>>>> Hidden Text <<<<
The controlling language of this Agreement is English

Here is summary for the previous window that does work fine:

>>>> Window <<<<
Title: Installing Sage 50 Accounting Release 2015.0...
Class: #32770
Position: 584, 322
Size: 504, 436
Style: 0x94C800C4
ExStyle: 0x00010101
Handle: 0x000A03AA

>>>> Control <<<<
Class: 
Instance: 
ClassnameNN: 
Name: 
Advanced (Class): 
ID: 
Text: 
Position: 
Size: 
ControlClick Coords: 
Style: 
ExStyle: 
Handle: 

>>>> Mouse <<<<
Position: 860, 338
Cursor ID: 0
Color: 0xD0DEEB

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
&Next >
Cancel
< &Back
Product installation
Please 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

  • 2 weeks later...

Hello try to use [TITLE: your title] or [CLASS_ you class]  and run as Admin too.

Does your code work in other machine?

 

Saludos

Link to comment
Share on other sites

  • 3 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...