AutoHotkey Community

It is currently May 26th, 2012, 10:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: October 28th, 2009, 3:58 pm 
I am able to get to the menu item that I want (as seen in the attached image) without mouse commands:

Image

However, before executing it, I would like verify that it is checked.

How do I do that?

Thx!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 4:43 pm 
Offline

Joined: January 10th, 2009, 2:57 pm
Posts: 19
I don't know what software you are using and the behavior may be software dependent. But, after highlighting the entry, the enter key usually forces it to be checked. Whether it was originally or not.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 5:26 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
Try sending the {Appskey}, then e.g. Send i, n for arraging by name (the underlined character within the menu).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 5:31 pm 
Offline

Joined: October 9th, 2006, 8:19 pm
Posts: 236
Location: Finland
Get Info from Context Menu

_________________
Pekka Vartto


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 7:43 pm 
svi wrote:

Thank you all. Unfortunately it seems that I didn't explain my question well enough.

I just want to retrieve the status (that checkmark next to the menu item text). That's all. How do I do that?

The answer provided by svi is the closest to what I am looking but it relies on the mouse being the one selecting that menu.

I need a method that doesn't use the mouse at all. Is there such a thing?

Thx.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 28th, 2009, 10:21 pm 
Offline

Joined: October 9th, 2006, 8:19 pm
Posts: 236
Location: Finland
n00b7 wrote:
I need a method that doesn't use the mouse at all. Is there such a thing?

Sure there is. Replace these lines:
Code:
;Get mouse position and handle to wnd under the mouse cursor
  MouseGetPos, MouseScreenX, MouseScreenY, MouseWindowUID, MouseControlID
  WinGet,ControlHwnd, ID,ahk_id %MouseWindowUID%
with these:
Code:
IfWinNotExist ahk_class #32768
{
   ToolTip
   Return
}
 WinGet,ControlHwnd, ID,ahk_class #32768
(in Get Info from Context Menu),
so you'll get the info whenever the menu is shown.

But probably you want to retrieve the status without showing the menu...
Perhaps also that's been done (I'm too busy to try/search it now).

_________________
Pekka Vartto


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2009, 4:48 am 
svi, you are a genius. What you suggested works perfectly:

svi wrote:
WinGet,ControlHwnd, ID,ahk_class #32768

But now I am puzzled: Winspector Spy says that both the main context menu and its submenu have the same class name #32768.

So, how does WinGet know to get the hWnd of the submenu instead of the main menu?

To further explain my question: If I follow WinGet by the following statement:
Code:
ContextMenCnt := GetContextMenuCount(hWnd)

Then I get the correct number of menu items in the submenu - if the submenu is open. And I get the correct number of menu items in the main menu - if the submenu is not open.

Obviously, I don't understand how this works. Can you (or anyone) explain?

Thx!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 29th, 2009, 7:54 pm 
Offline

Joined: October 9th, 2006, 8:19 pm
Posts: 236
Location: Finland
n00b7 wrote:
So, how does WinGet know to get the hWnd of the submenu instead of the main menu?

It just gets the handle of the topmost (in this case most recent) window that matches the specifications.

_________________
Pekka Vartto


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], JSLover, Maestr0, Miguel, nimda, rbrtryn and 57 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group