WoodGrain

How do I click this button?

6 posts in this topic

#1 ·  Posted (edited)

Hi guys,

Trying to map my mouse button 4 (I'm pretty sure it's 4 rather than 5, but I can experiment) to click the back button in a program (screenshot attached). In terms of positioning it sits in the middle of 3 screens if that makes a difference.

I assume I can use something like (though I prob don't need the 1st two lines if using ControlClick?):

WinActivate("ConnectWise v2016.4 (41139)", "Chrome Legacy Window")
WinWaitActive("ConnectWise v2016.4 (41139)", "Chrome Legacy Window")
ControlClick("ConnectWise v2016.4 (41139)", "Chrome Legacy Window", "[CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]", "Left", 1, 0, 30)

When I hover my mouse over the button I get the following information in Window Info

>>>> Window <<<<
Title:  ConnectWise v2016.4 (41139)
Class:  TabBrowser_MainFrame
Position:   -8, -8
Size:   1696, 1026
Style:  0x17CF0000
ExStyle:    0x00040100
Handle: 0x0000000000010C56

>>>> Control <<<<
Class:  Chrome_RenderWidgetHostHWND
Instance:   1
ClassnameNN:    Chrome_RenderWidgetHostHWND1
Name:   
Advanced (Class):   [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:1]
ID: 315622768
Text:   Chrome Legacy Window
Position:   0, 30
Size:   1680, 957
ControlClick Coords:    81, 138
Style:  0x56300000
ExStyle:    0x00000020
Handle: 0x0000000000040AC6

>>>> Mouse <<<<
Position:   81, 191
Cursor ID:  0
Color:  0x004E7F

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
ConnectWise: My Calendar
Chrome Legacy Window


>>>> Hidden Text <<<<
Chrome Legacy Window

 

Back Button.jpg

Edited by WoodGrain
Additional information.

Share this post


Link to post
Share on other sites



You are using x,y params wrong, when used the coords must be the

ControlClick Coords:    81, 138

not the absolut MousePos coords.

Share this post


Link to post
Share on other sites

That should have been so obvious given the position of the button was not anywhere near 0, 30 lol. TBH, I had some issues figuring out the controlID, turns out the above was correct by using the "Advanced (Class)", so while I was posting I was trying to figure that out more so than the coords.

Those coords work, all working now, thanks AB

Share this post


Link to post
Share on other sites

Hmm, ok, so it's not working again, looks like the contolID is different...

Can someone advise what I can use in the ControlID field of the ControlClick()?

>>>> Window <<<<
Title:  ConnectWise v2016.4 (41139)
Class:  TabBrowser_MainFrame
Position:   -8, -8
Size:   1696, 1026
Style:  0x17CF0000
ExStyle:    0x00040100
Handle: 0x0000000000010C56

>>>> Control <<<<
Class:  Chrome_RenderWidgetHostHWND
Instance:   2
ClassnameNN:    Chrome_RenderWidgetHostHWND2
Name:   
Advanced (Class):   [CLASS:Chrome_RenderWidgetHostHWND; INSTANCE:2]
ID: 314454488
Text:   Chrome Legacy Window
Position:   0, 30
Size:   1680, 957
ControlClick Coords:    81, 140
Style:  0x56300000
ExStyle:    0x00000020
Handle: 0x0000000000050980

>>>> Mouse <<<<
Position:   81, 193
Cursor ID:  0
Color:  0xFFFFFF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
ConnectWise: My Calendar
Chrome Legacy Window


>>>> Hidden Text <<<<
Chrome Legacy Window

 

Share this post


Link to post
Share on other sites

1st bump.

Share this post


Link to post
Share on other sites

Hello.

Two options.

1.- Use mouse positions.

2.- Use IUIAutomation

Saludos


 

venezuela.png Would you like to say thank to Danyfirex using a warmy way?  offer me a cup of coffee... coffee.png

autoit_scripter_blue_userbar.png

       AutoIt...

 

 

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

    • robcull
      By robcull
      Hello all! I have had some issues reading text from different types of windows, occasionally, specifically with controlgettext. 
      **Before I begin, I know there are better ways to do what I attempt in the example below. That's not the point of this post. The point is my issues with controlgettext. 
      I am about to cite an example with an application you may be familiar with called SpeedFan (v4.52). My problem is not specific to speedfan, it is simply the most recent and easily reproducible example I can think of. 
      So, the goal of the script below is to get a string of text containing the current fan RPMs from the highlighted control in the screenshot below (see "speedfan_control_details.png").

      Now, here's a simple script for grabbing the window handle and reading the text from that control: 
      $wintitle = "SpeedFan 4.52" $controlID = "197934" ;will be reformatted as "[ID:######]" $hwnd = wingethandle($wintitle) if @error<>0 then msgbox(0, "WinGetHandle", "FAILURE. @error="&@error) Exit EndIf $text = ControlGetText($hwnd, "", "[ID:"&$controlID&"]") if @error=1 then msgbox(0, "ControlGetText", "FAILURE. @error="&@error) ;failure returns "" and @error=1 Exit EndIf msgbox (0, "ControlGetText", "SUCCESS. @error="&@error &@CRLF& "$text="&$text) ;success returns string and @error=0 You'll see that the ControlGetText operation runs without error, however it does not capture any text from the control. If you explore the other controls in this one window, you'll find mixed results across the board. Neither the temps nor voltages can be read, while the log field and some other elements can be read. Even when you read the text from the whole window, those elements are not included in the visible nor hidden texts. 
       
      I have run into this issue many times in the past- inconsistencies in the ability of autoit to interact with certain controls. What is it which makes this text different than any other readable texts? Is there an alternate method of reading the text in the window/control which could work? Any and all info to help me solve this mystery and satisfy my curiosity would be greatly appreciated. 
      Thanks  -Rob C
      PS: Running Autoit v3.3.14.2 on Win7 Ultimate x64
    • AppSoftwareVld
      By AppSoftwareVld
      Hello,
       
      I need this for a project and I don't find a method for the next problem.
      I want when I click a button to create a variable ("$variable1") so if I press one more time to create one more ("$variable2") and create more and more how many times you press the button.
       
      Do you have an idea ? 
      Thank you for your attention !
    • rte7
      By rte7
      Hello. We work with the BMC Remedy site to manage incidents and would like to automate the processes of clicking through this button code:
      <a href="javascript:" class="btn btn3d menu" style="top:21; left:184; width:21; height:21;"> <img class="btnimg" src="../../../../resources/images/mt_sprites.gif" alt="menu category issue" title=""> </a> I use firefox with mozrepl and autoit with include FF.au3
      I need your help
      I read the topic https://www.autoitscript.com/forum/topic/95595-ffau3-v0601b-10/ but I could not run the code from the listed commands
      ...
      It is necessary to press the button and from the list of the menu of cahorsations to select the item = "zone of trust abonent"
      Screen # 1 http://joxi.ru/52aJK7bh4a7ypA or below.
      1) Press button
      <a href="javascript:" class="btn btn3d menu" style="top:21; left:184; width:21; height:21;"> <img class="btnimg" src="../../../../resources/images/mt_sprites.gif" alt="menu category issue" title=""> </a>
      2) After pressing the button, I need to choose in this menu of 4 items to select an item called "zone of trust abonent", Screen # 2 - http://joxi.ru/p27gwQKHo71VQ2
      html code table items
      <table class="MenuTable" cellpadding="0" cellspacing="0" style="width: 179px;"> <tbody class="MenuTableBody"> <tr class="MenuTableRow"> <td class="MenuEntryName" nowrap="">zone of trust abonent</td> <td class="MenuEntryNoSub" arvalue="zone of trust abonent"></td> </tr> <tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">zone of trust operator</td> <td class="MenuEntryNoSub" arvalue="zone of trust operator"></td> </tr> <tr class="MenuTableRow"><td class="MenuEntryName" nowrap="">zone of trust third operator</td> <td class="MenuEntryNoSub" arvalue="zone of trust third operator"></td></tr> <tr class="MenuTableRow"><td class="MenuEntryNameHover" nowrap="">No settings</td> <td class="MenuEntryNoSubHover" arvalue="No settings"></td> </tr> </tbody> </table>
       
       
      More in detail, I choose from the menu item "zone of trust abonent" Screen # 3 - http://joxi.ru/GrqVq4ZIQEPW4m

       
      3) The choice is made, Screen # 4 http://joxi.ru/v297w6aC3PovLr
      <textarea class="text sr " wrap="off" id="arid_WIN_0_1000002488" cols="20" maxlen="60" style="top:21; left:0; width:179; height:21;" armenu="CFG:PRC:CategoryHPD-Res-T1-Q" mstyle="2" arautoc="1" arautocmb="1" arautocak="0" arautoctt="400" rows="1"> </textarea>
       
      It's all. I would be very grateful to you =) !!!!!!!!!!
      Here are more detailed codes in the attachment. 
      button1.txt
      menu - table.txt
      all.txt
    • Nareshm
      By Nareshm
      I create message box but i dont know how to add button action when i click it.

      Help for : Add script for Button : Left, Right, Right Finger
      example when i press Left finger button do Case $idNotepad
                      $iPID = WinActivate ( " :PS :: Version - 2.8.0.0  - [eFS Bill]")
                              ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:btnReset]", "{esc}")
                              ControlClick ( " :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]")
                              ControlSend(" :DS  - eF:: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "^v")
                              ControlSend(" :DS  - eF :: Version - 2.8.0.0  - [eF Bill]", "", "[NAME:txtrdNo]", "{enter}")
      How to add like above ?
                    
                                                                sorry for my bad english
       
    • Skeletor
      By Skeletor
      Hi Guys, 
      So with me working in my Virtual Machines in full screen, I often have my Host OS playing music. Now the issue I had was trying to control the Host OS without having to minimise the Guest OS.
      So I thought of this small program. I call it the Volume Control. It resides in the bottom right hand corner of your screen just above the system clock. 
      I'm still working on getting the volume buttons to increase/decrease when you hold down the button.
      Currently, you will need to tap on the volume buttons numerous times to decrease/increase the volume. 
      Any other improvements let me know. 
      The source code, icon and compiled program are already in the zip. 
       

       
      Volume Controlv1.zip
      Screenshot.bmp