Sign in to follow this  
Followers 0
OtenMoten

Click a element in an external program

5 posts in this topic

#1 ·  Posted (edited)

Hello dear community,

 

definitely I need external help now. I've did all 'ControlClick() - Tutorials' and read a lot of topics about interaction betweend AutoIT and external programs.

The most of them are about "Clicking a button ...". In my case it's different because I need to click a specific element within the program.

 

The 'program' what I am talking about is called Mendeley. It's library software for documents administration.

 

In the attachements in picture '1.jpg' you can see the red marked Help element. 

In the picture '2.jpg' you see the context menu of the Help element. This is what I'm trying to do with the ControlClick() function.

 

Following I represent my code which not worked for me:

#include <MsgBoxConstants.au3>

Opt("WinTitleMatchMode", 2)

$hWnd = WinGetHandle("Mendeley Desktop", "")
MsgBox($MB_SYSTEMMODAL, "handle check", $hWnd)

ControlClick($hWnd, "Mendeley Desktop", "Help")

The MsgBox tells me the number of the handle of the Mendeley window. It's not 0 so for me it means the window is recognized correctly.

 

When I'm execute the script the Help element is not clicked.

Any suggestions for me?

 

Kind regards

OtenMoten

1.JPG

2.jpg

Edited by OtenMoten

Share this post


Link to post
Share on other sites



What you need is WinMenuSelectItem().

1 person likes this

When the words fail... music speaks

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

25 minutes ago, Andreik said:

What you need is WinMenuSelectItem().

It seems not to be working.

 

#include <MsgBoxConstants.au3>

Opt("WinTitleMatchMode", 2)

$hWnd = WinGetHandle("Mendeley Desktop", "")
WinMenuSelectItem($hWnd, "", "&Help")

 

I found this in the Help of WinMenuSelectItem():

"WinMenuSelectItem() will only work on standard menus. Unfortunately, many menus in use today are actually custom written or toolbars "pretending" to be menus. This is true for most Microsoft applications."

Any other options for me?

Edited by OtenMoten

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I don't have the application to test but you might use some keystroke combination or AutoIt recorder to see what code generate.

 

PS: use Au3Info and post a picture to see what type of control it is

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

read FAQ 31 and try the different spy tools and show the output of these spying apps (au3inf and simplespy: If it highlights you can program it)

It looks a normal menu and most likely Au3Info snapshot will help. If not you have to 

a. switch to sendkeys (alt+h)

b. switch to IUIAutomation see references in FAQ 31

1 person likes this

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
Sign in to follow this  
Followers 0

  • 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?
       
    • SkysLastChance
      By SkysLastChance
      <input name="VsMasterPage$MainContent$LoginUserControl$LoginForm$FormsAuthLoginContainer$LoginButton$InternalButton" class="Button" id="VsMasterPage_MainContent_LoginUserControl_LoginForm_FormsAuthLoginContainer_LoginButton_InternalButton" onclick='javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("VsMasterPage$MainContent$LoginUserControl$LoginForm$FormsAuthLoginContainer$LoginButton$InternalButton", "", true, "Login", "", false, false))' type="submit" value="Sign In"> I am trying to click the sign in button on this page. 
      I have tried by class, text, etc 
      Here was my last attempt
      $oButtons = _IETagNameAllGetCollection($o_IE, "button") For $oButton in $oButtons If String($oButton.value) = "Sign In" Then Sleep (1000) _IEAction($oButton, "click") ExitLoop EndIf Next This did not work either.
    • 5ervant
      By 5ervant
      Go create a quick account in Zapier and go to https://zapier.com/app/dashboard and make some Zaps!
      Just need to click the specific instance of an .open-menu button and then click its a.run (anchor) element.
      Doing this IE.au3 script just causing to click its container element:
      $target = 1; Target the first instance #include <IE.au3> $oIE = _IEAttach("Dashboard - Zapier") $count = 0; $tags = _IETagNameGetCollection($oIE, "div") For $tag in $tags $class_value = $tag.GetAttribute("class") If $class_value = "open-menu" Then $count += 1 if $count = $target Then MsgBox(0, "Instance: ", $count) ; $tag.fireEvent("onmousedown") ; _IEAction($tag, "click") ; $tag.fireEvent("onmouseup") ; Or this but not working ; $tag.Click EndIf EndIf Next I also tried to do it using FF.au3
      $target = 1; Target the first instance #Include <Array.au3> #Include <FF.au3> $count = 0; If _FFConnect(Default, Default, 3000) Then $aArray = _FFXPath( "//div[@class='open-menu']", "", 7 ) ; _ArrayDisplay($aArray) For $tag in $aArray $count += 1 if $count = $target Then MsgBox(0, "Instance: ", $count) _FFClick($tag) EndIf Next EndIf Error: _FFClick ==> No match: $sElement: [number]
      Could some help me how to click such buttons on such kind of a dynamic page?
    • dejhost
      By dejhost
      Hi everybody,
      I have troubles using the function "GUISetCursor" properly.
      My script generates a small GUI and opens an image in IrfanView. If the user hits the button "$p_coord" on the GUI, the GUI shall be hidden, IrfanView shall become active and the mousepointer shall turn into a cross (as long hovering over IrfanView). Once clicked into IrfanView, the cursor shall turn into a nordinary mousepointer again.
      Unfortunately, the cross doesn't appear until the user clicks into IrfanView manually. Then the mousepointer changes for the duration of the click into the cross. Can anybody tell why this is happening?
      Here is the relevant code:
      GUISetState(@SW_SHOW, $hGUI) ;the autoit gui is hidden ; Loop until the user exits: While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $p_coord WinSetState("Bicon Coordinator","",@SW_HIDE) ;the autoit gui is hidden $Handle = WinActivate ( "IrfanView") ; IrfanView is activated GUISetCursor (15,1,$Handle) ;Cursor should be turned into a cross - this is what fails :-( While 1 If _IsPressed ("01", $hDLL) Then ;Once a mousclick by the user is performed... GUISetCursor (2) EndIf EndSwitch WEnd  
      dejhost
       
       
       
       
       
    • WoodGrain
      By WoodGrain
      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