Jump to content

Embeded GUI Controls Help


Recommended Posts

Hello AutoIT Forums...this my first post since I've been lurking for many years.

I'm stuck automating an application install.  

Basically, I cannot single out some controls in a window and was wondering if someone can help direct me with a way to figure them out. They appear to be normal controls (.net most likely) except they are embedded in a box.  

 

Attached is a picture of the buttons I want to access

post-76894-0-38781500-1395704918_thumb.p

When using the AutoIT Window Info Tool, it highlights the entire box but not the controls individually.

The 3 buttons outside the box work perfectly fine with the Info Tool.

 

This is the info it returns:  It thinks it's a button...

>>>> Window <<<<
Title: ProSystem fx Installation
Class: #32770
Position: 433, 198
Size: 623, 298
Style: 0x94C800C4
ExStyle: 0x00050101
Handle: 0x009104FA
 
>>>> Control <<<<
Class: Button
Instance: 9
ClassnameNN: Button9
Name:
Advanced (Class): [CLASS:Button; INSTANCE:9]
ID:
Text:
Position: 11, 7
Size: 593, 216
ControlClick Coords: 198, 155
Style: 0x50000007
ExStyle: 0x00000004
Handle: 0x008C07EC
 
>>>> Mouse <<<<
Position: 645, 385
Cursor ID: 0
Color: 0xF7F3F7
 
>>>> StatusBar <<<<
 
>>>> ToolsBar <<<<
 
>>>> Visible Text <<<<
OK
E&xit
&Help
&CD/DVD drive:
[-z-]
Permissions key:
&Internet download
&Use previously installed permission key
&Permission key disk drive path:
a:
&Browse
Chec&k available disk space for installation
 
 
>>>> Hidden Text <<<<
[-t-]
 

 

How can I access these control within this box? Any suggestions/help are appreciated!  Thanks!

-Brandon

Link to comment
Share on other sites

You can try with the UI Automation framework.

Download the two UDFs in bottom of first post, and download and run the code in the "Simple spy demo" codebox in the middle of first post.

To verify that a control can be identified place the mouse cursor over the control and press Ctrl+w. You can see an example here.

Link to comment
Share on other sites

  • Moderators

You could also use the MSI located on the installation CD, and do a silent install. Then you can bypass trying to automate the GUI.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • 2 weeks later...

Sometimes, the 'z-order' of applications is messed up.  You'll have to loop through all controls, and note their identification for use in your script, later...

Run this, while the window is active

#include <Array.au3>
#include <WinAPI.au3>
Sleep(5000)
Var_GetAllWindowsControls2("[ACTIVE]")
Func Var_GetAllWindowsControls2($hCallersWindow)
    ; Get all list of controls
    $sClassList = WinGetClassList($hCallersWindow)
    ; Create array
    $aClassList = StringSplit($sClassList, @CRLF, 2)
    ; Sort array
    _ArraySort($aClassList)
    _ArrayDelete($aClassList, 0)

    ; Loop
    Local $iCurrentClass = "", $iCurrentCount = 1, $iTotalCounter = 1

    For $i = 0 To UBound($aClassList) - 1
        If $aClassList[$i] = $iCurrentClass Then
            $iCurrentCount += 1
        Else
            $iCurrentClass = $aClassList[$i]
            $iCurrentCount = 1
        EndIf

        $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]")
        $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}")
        $aPos = ControlGetPos($hCallersWindow, "", $hControl)
        $sControlID = _WinAPI_GetDlgCtrlID($hControl)
        If IsArray($aPos) Then
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[" & StringFormat("%4s", $aPos[0]) & "] YPos=[" & StringFormat("%4s", $aPos[1]) & "] Width=[" & StringFormat("%4s", $aPos[2]) & "] Height=[" & StringFormat("%4s", $aPos[3]) & "] Text=[" & $text & "]." & @CRLF)
        Else
            ConsoleWrite("Func=[Var_GetAllWindowsControls]: ControlCounter=[" & StringFormat("%3s", $iTotalCounter) & "] ControlID=[" & StringFormat("%5s", $sControlID) & "] Handle=[" & StringFormat("%10s", $hControl) & "] ClassNN=[" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF)
        EndIf
        If Not WinExists($hCallersWindow) Then ExitLoop
        $iTotalCounter += 1
    Next
EndFunc   ;==>Var_GetAllWindowsControls
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

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