Jump to content

Click a element in an external program


 Share

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

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

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

×
×
  • Create New...