Jump to content

Installer automation


Recommended Posts

Hi,

So I am trying to automate an installer as per the customer requirements because he wants to see the buttons being clicked when he runs the script even though we can install this silently.  This is my code

***************************************************

Run("C:\\QA\\MVAutomation\\foo.exe")

;wait for window to be active
; WinWaitActive("Title1")

Local $hWnd = Title1")
WinActivate("Title1") ; maybe redundant

; click on Check box for license agreement
ControlClick($hWnd, "", "Button2")

; click on install Button
ControlClick($hWnd, "", "Button4")

Local $hWnd2 = WinWait("Title2")
WinActivate("Title2", "&Next")

While ControlCommand( "Title2", "&Next", "Button1","IsEnabled","") = 0
    Sleep(50)
 WEnd

ControlFocus ( "Title2", "&Next", "Button1" )
ControlClick ( "Title2 Setup", "&Next", "Button1" )

ConsoleWrite("Initial window handle: " &$hWnd)
ConsoleWrite("Active window handle: " &$hWnd2)

 

************************************************************

The thing that I am having issues is that it never clicks on the Button1 on the Second Screen (Title2).

The installer has both windows open at this time but as you can see I have activated 'Title2" window

When I use the Window Info tool and look at the handle for the Title1 window I can see is the same one as written here: ConsoleWrite("Initial window handle: " &$hWnd)

BUT when I use the tool to look at the handle for the Title2 Window which has the button I want to click on is different from the one here: ConsoleWrite("Active window handle: " &$hWnd2)

This leads me to believe that apparently the automation must be looking at the wrong handle and then can't see the button !!!

Any leads or tips on this are greatly appreciated.

Thank you


 

 

Link to comment
Share on other sites

thanks

In here I want to click on Next button

Local $hWnd2 = WinWait("MicroViewer v1.31.0.1 Setup")
WinActivate("MicroViewer v1.31.0.1 Setup", "&Next")

When I write the handle out I get this value: Active window handle: 0x00030B2C

When I look at tool info I see this:

>>>> Window <<<<
Title:    MicroViewer v1.31.0.1 Setup
Class:    MsiDialogCloseClass
Position:    766, 96
Size:    499, 389
Style:    0x94CA0000
ExStyle:    0x00000100
Handle:    0x0000000000030B66

 

Here is the button info:

>>>> Control <<<<
Class:    Button
Instance:    1
ClassnameNN:    Button1
Name:    
Advanced (Class):    [CLASS:Button; INSTANCE:1]
ID:    877
Text:    &Next
Position:    314, 324
Size:    74, 22
ControlClick Coords:    47, 12
Style:    0x50032001
ExStyle:    0x00000000
Handle:    0x0000000000030B42

 

Sorry I'm new at this and apologize for any missing info in advance.

 

Thanks

 

 

Link to comment
Share on other sites

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