PINTO1927

Click a button through Title-Class-Instance

10 posts in this topic

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



OMain is the Class for the entire window, whereas MsoCommandBar Instance 1 would be the class info for the Control itself. Which are you trying to click on?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

button.png

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

AutoIT Windows Info section Control ID does not show me any results.
That code would you feel?

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

#8 ·  Posted (edited)

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

the toolbar tab does not show me anything ..

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

    • boy233
      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?
       
    • CADMonkey
      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.
       
    • ripdad
      By ripdad
      Here is  another WMIC script that parses properties from various alias classes.
      ie: COMPUTERSYSTEM, CDROM, IDECONTROLLER, DISKDRIVE, etc.
      Download:  WMIC_GET.au3
       
    • nbg15
      By nbg15
      Hello everybody,
      i've spent hours to google and find out how to get content of scrollable list view of our CMS Software...
      i checked it with the "AutotIT window info" tool, but the only things I get are this:

      Class: Qt5QWindowIcon
      Instance: 18
       
      but how can I get list contents of a class like that?
       
      I was using AutoIT couple a months ago (but it was a ListView32 box) <-- was easy
       
      Thanks for any hints...
       
      Rickey
       
      P.S: I also checked the AutoIT Editors help pages (Keywords: "Qt5QWindowIcon" "Qt5Q", nut cant find nothing... Thanks!
    • NiceBoy1234
      By NiceBoy1234
      How do I close a usb pop up window with auto it.
      If one plugs in a usb a pop up window appears like "would you like to check and repait the device..."
      The window has a window class of #32770, since I have to open permanently another window with that same class, I cannot WinClose("[#32770]").

      Is it possible to close the window with it's Basic Control Info Class?
      In this case it would be 'DirectUIHWND'