Mouse - Right Click and Context Menu?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
marvinlb
Newbie
Posts: 4
Joined: Wed Jan 07, 2009 5:06 pm

Mouse - Right Click and Context Menu?

Post by marvinlb » Thu Jan 28, 2016 5:39 pm

I want to script a fairly simple sequence:
- Right click at current position (a context menu opens)
- Select "x" from the context menu
etc.


Is Image Recognition of the context menu, followed by the desired context menu option, followed by positioning of the cursor on the center of the image, the only approach to accomplish this?

I'm sure the right click -> context menu is a common use case, but how to handle it if I'm not able to identify the specific window of the Context Menu (even with the "View System Windows" tool)?

thank you-

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Mouse - Right Click and Context Menu?

Post by JRL » Thu Jan 28, 2016 7:08 pm

Will GetFocusedObject> work?
Help wrote:GetFocusedObject>handle
Returns the handle of the currently focused object.

marvinlb
Newbie
Posts: 4
Joined: Wed Jan 07, 2009 5:06 pm

Re: Mouse - Right Click and Context Menu?

Post by marvinlb » Thu Jan 28, 2016 7:57 pm

JRL-
Thank you for your reply. That does get me the handle of the application's main window - however, the application has several windows within it, and I cannot seem to get the handle of the specific child window I need. I may be able to get by with this - if, in returning focus to the main window, the system assumes that the focus is not only on the application's main window generally, but is also on the specific entry in the specific window that it was last. Otherwise - Image Recognition.

thank you again-

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts