Jump to content
PINTO1927

Click a button through Title-Class-Instance

Recommended Posts

Hello guys,
I need to be able to make a mouse click on a program.
Via Windows AutoIT info I managed to recover the data that are needed me but I can not make him do the left click.

$gat = WinGetHandle("[TITLE:GAT.crm [DIST ]; CLASS:OMain; INSTANCE:1]", "")
ControlClick($gat, "", "PAUSA")

did I do something wrong? :'(

windows info.png

Share this post


Link to post
Share on other sites

button.pngI'm trying to do a control-click on the "PAUSA" button, I am attaching the screen.

 

Edited by PINTO1927

Share this post


Link to post
Share on other sites
6 hours ago, PINTO1927 said:

I'm trying to do a control-click on the "PAUSA" button, I am attaching the screen.

and why didn't use the controlid?

Share this post


Link to post
Share on other sites

This is a result that brings me:

>>>> Window <<<<
Title:  GAT.crm [DIST ]
Class:  OMain
Position:   -8, -8
Size:   1616, 876
Style:  0x17CF0000
ExStyle:    0x00000100
Handle: 0x0000000000420676

>>>> Control <<<<
Class:  MsoCommandBar
Instance:   1
ClassnameNN:    MsoCommandBar1
Name:   
Advanced (Class):   [CLASS:MsoCommandBar; INSTANCE:1]
ID: 
Text:   Main
Position:   0, 25
Size:   986, 26
ControlClick Coords:    816, 18
Style:  0x56000000
ExStyle:    0x00000000
Handle: 0x00000000003E037A

>>>> Mouse <<<<
Position:   816, 65
Cursor ID:  0
Color:  0xA9C7F0

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
MsoDockLeft
MsoDockRight
MsoDockTop
Main
Menu Bar
MsoDockBottom
Menu Principale


>>>> Hidden Text <<<<
Gat-enterprise : Project - DIST (Access 2000 file format)
MSO Generic Control Container

 

Share this post


Link to post
Share on other sites

With this code I was able to push the desired button by cordinates, but if I change resolution rightly does not work.

$services = "GAT.crm [DIST"

_WinWaitActivate("GAT.crm [DIST","")
Sleep(1000)
ControlClick($services, "", "MsoCommandBar1", "Left", 1, 807, 10)

Since AutoIT Windows Info does not provide me the info ControlID, there is the possibility to intercept the button text, in this case "PAUSA"?

Edited by PINTO1927

Share this post


Link to post
Share on other sites

You can test if Controlcommand gives you the ID:

Quote

"SendCommandID", Command ID Simulates the WM_COMMAND message. Usually used for ToolbarWindow32 controls - use the ToolBar tab of Au3Info to get the Command ID.

 

Share this post


Link to post
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

  • Similar Content

    • By XinYoung
      Greetings!
      I am in need of your guidance once again. I searched the forums for clicking in span, clicking by class, clicking without an ID or Name, etc., but I am unable to find a solution for my problem.
      I am trying to expand this tree in IE. There is an arrow ( > ) that i need to click, but I can't find a way to do it . Alternatively, I can double-click the text "Servers", but that seems to be even more troublesome. I will have to do this 2-3 more times as the tree expands.
      There appears to be an ID for the tree, simply called "tree", but that isn't working when I send a click to it.

      ;Open an IE session and navigate to pgAdmin. Global $oIE = _IECreate($pgAdmin) ;Maximize the IE window. WinSetState(_IEPropertyGet($oIE, "hwnd"), "", @SW_MAXIMIZE) Sleep(2000) ;Expand the tree $oTree = _IEGetObjById($oIE, "tree") _IEAction($oTree, "click") Any ideas?  
    • By Pricehacker
      Hello again!
      I have tried searching for quite some time now but couldn´t find a single working way to change the class of your GUI that doesn´t include changing it manually after its compilation.
      First or "AutoIt v3 GUI" is a pretty boring name tbh and i would like to spice it up a bit, also, and more importantly, I would like to identify my windows by something other than its title as it will change depending on some factors and im using two different programs independently as multi threading isn't supported.
      Any help is appreciated! Thank you!
    • By boy233
      I need to click on the text "Batch submission" but I can not!
      <div class="batchmenu2" onclick="Go('/lot/')" style="background-color: rgb(255, 255, 255);"> <span class="iconep">l</span> <div class="menu"> <b>Batch submission</b> <br> Bulk messages via file </div> </div> How could I do it?
      How can I click the specific OnClick?
       
    • By CADMonkey
      Hi,
      I have created a bit of code to enable a script to find named controls on a userform, even though the MS CLASS description changes between machines.
      e.g. The CLASS "WindowsForms10.EDIT.app.0.24b689f_r14_ad1" for a text box on one PC is different on another.
      The below code, (a cut-down version of the code from jdelaney original post)  loops through all the controls and finds the first one with the desired string in the control class name - in this case "EDIT".  This name is then usable for setting the text using ControlSetText.
       
      #include <array.au3> WinActivate("Edit Part Rule") $TheClassName = GetAllWindowsControls(WinGetHandle("Edit Part Rule"), "EDIT") ;Sleep(500) ControlSetText("Edit Part Rule", "", "[CLASS:" & $TheClassName & "; INSTANCE:3]", $CmdLine[1]) ControlSetText("Edit Part Rule", "", "[CLASS:" & $TheClassName & "; INSTANCE:4]", $CmdLine[2]) Func GetAllWindowsControls($hCallersWindow, $sStringIncludes) ; Get all list of controls $sClassList = WinGetClassList($hCallersWindow) ; Create array $aClassList = StringSplit($sClassList, @CRLF, 2) ; Sort array _ArraySort($aClassList) _ArrayDelete($aClassList, 0) ; Loop For $i = 0 To UBound($aClassList) - 1 If StringInStr($aClassList[$i], $sStringIncludes) Then Return $aClassList[$i] EndIf Next EndFunc ;==>GetAllWindowsControls If anyone has any suggestions to improve it, or a better way to achieve the same thing, please let me know.
       
    • By ripdad
      Here is  another WMIC script that parses properties from various alias classes.
      ie: COMPUTERSYSTEM, CDROM, IDECONTROLLER, DISKDRIVE, etc.
      Download:  WMIC_GET.au3
       
×
×
  • Create New...