Jump to content

(Control-)Click non-standard control somehow possible?


Recommended Posts

Hi everyone.

I'm trying to click a certain button inside a window, which does not seem to be a standard control.

I checked it with the Autoit Window Info and with Control Viewer. All I know is that it is placed inside another control.

Posted Image

So as you see I am talking about the yellow folder button.

I already tried:

ControlClick("[CLASS:TAnimationForm]","","[CLASS:TPanel; INSTANCE:2]","left",19,221)

Which worked perfectly in a very similar scenario (for some weird reason) but here I can't click the icon.

In case there really is no way of finding the control, is there any workaround that would allow me to hide the window and still click the button?

Link to comment
Share on other sites

If it is a custom control where identifying it by some object property is impossible, it looks unique enough to the window to do an ImageSearch or some PixelSearch / PixelChecksum routine to find the folder image position... perhaps.

Lar.

f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Link to comment
Share on other sites

Remove the pixed coords of the control click, that's obviously ouside the the Rect bounds of the control...ControlClick defaults to click the center of the control. I'd check if the ID remains constant between launches also, and use that to identify- if it doesn't change.

Edit: You probably have issues with the zorder of the controls, so you aren't focusing on the button, but instead the 'panel' that should be behind it...use something like this to find your control (insert your window-handle into the function call):

#include <Array.au3>
#include <WinAPI.au3>
Var_GetAllWindowsControls2(HWnd("0x0000000000060740"))

 
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
 $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]","[email="{@CRLF"]{@CRLF[/email]}")
  $aPos = ControlGetPos($hCallersWindow, "", $hControl)
  $sControlID = _WinAPI_GetDlgCtrlID($hControl)
  If IsArray($aPos) Then
   ConsoleWrite("ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[" & $aPos[0] & "] YPos=[" & $aPos[1] & "] Width=[" & $aPos[2] & "] Height=[" & $aPos[3] & "] Text=[" & $text & "]." & @CRLF)
  Else
   ConsoleWrite("ControlCounter=[" & $iTotalCounter & "] ControlID=[" & $sControlID & "] Handle=[" & $hControl & "] ClassNN=[" & $iCurrentClass & $iCurrentCount & "] XPos=[winclosed] YPos=[winclosed] Width=[winclosed] Height=[winclosed] Text=[" & $text & "]." & @CRLF)
  EndIf
  If Not WinExists($hCallersWindow) Then ExitLoop
  $iTotalCounter+=1
 Next
EndFunc
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...