Kyle7286 Posted March 24, 2014 Share Posted March 24, 2014 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 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 More sharing options...
LarsJ Posted March 25, 2014 Share Posted March 25, 2014 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. Controls, File Explorer, ROT objects, UI Automation, Windows Message MonitorCompiled code: Accessing AutoIt variables, DotNet.au3 UDF, Using C# and VB codeShell menus: The Context menu, The Favorites menu. Shell related: Control Panel, System Image ListsGraphics related: Rubik's Cube, OpenGL without external libraries, Navigating in an image, Non-rectangular selectionsListView controls: Colors and fonts, Multi-line header, Multi-line items, Checkboxes and icons, Incremental searchListView controls: Virtual ListViews, Editing cells, Data display functions Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 25, 2014 Moderators Share Posted March 25, 2014 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 More sharing options...
Kyle7286 Posted April 7, 2014 Author Share Posted April 7, 2014 (edited) Unfortunately there's no Silent install for this application. I will look into the UDFs and report back. Thanks! Edited April 7, 2014 by BrandonHaley Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 7, 2014 Moderators Share Posted April 7, 2014 It is an MSI, by its very nature it supports /qb and /qn "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 More sharing options...
jdelaney Posted April 7, 2014 Share Posted April 7, 2014 (edited) 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 expandcollapse popup#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 April 7, 2014 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...
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