Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Get menu state
#1
Outlook Express Menu :

It works :
int w1=win("New Message" "ATH_Note")
men 40368 w1

It fails (item not found.) :
int i=men(40368 w1)

Any advice will be much appreciated.
#2
The first code sends menu message even if the item does not exist.

Maybe the menu item exists only when the menu is visible, or after it was visible once.

This code works.
Macro Macro2872
Code:
Copy      Help
int w1=win("Untitled - Notepad" "Notepad")
act w1
men 27 w1 ;;Status Bar
key Av ZZ ;;show menu, to update menu item state
out men(27 w1)
#3
Thank you. Your example, with Notepad, works perfectly. However, in the case of Outlook Express :
key At ZZ
out men(40368 w1)

it is still failing with error.
#4
These menu bars with 4 dots are not standard menus. Although their submenus are. But QM need a standard menubar to find the id in its submenus.
Try accessible objects.

Macro Macro272
Code:
Copy      Help
int w=win("New Message" "ATH_Note")
act w
key Av
int w2=wait(5 WV "+#32768") ;;submenu
Acc a.Find(w2 "MENUITEM" "Status Bar" "" 0x1001 2)
int checked=a.State&STATE_SYSTEM_CHECKED!=0
key ZZ
out checked
#5
It works perfectly! Many thanks indeed.
#6
Sorry to kick this up.

But how do you output the menu id of an submenu item, when the application uses normal menu's.
Example, notepad++ I can see the menu id in QM (lower left corner in QM).
And I can use the "men" command.

But now I want to output this id's
For example, I can output all the menu names from the "Search" menu

Macro Macro99
Code:
Copy      Help
int w=win("Notepad++" "Notepad++")
Acc a.Find(w "" "Search" "class=Notepad++" 0x1005 0 0 "Child1")
ARRAY(Acc) ac
a.GetChildObjects(ac)

int i
for i 0 ac.len
,out ac[i].Name

But how do I output the id's of ac (if possible)?

Note: I had to use an empty rolename, because the child rolename was MENUPOPUP "context" and I had to target tit's childeren, but the problem is there are multiple MENUPOPUP "context". With the above method I could target the childeren. I could not succeed using "first" (child).


   
 
#7
Macro enum menu items
Code:
Copy      Help
out
int w=win("Notepad++" "Notepad++")
int hmenu=GetMenu(w)
if(hmenu=0) out "no menu"; ret
sub.EnumSubmenu(hmenu 0)


#sub EnumSubmenu
function hm level
int i n=GetMenuItemCount(hm)
for i 0 n
,str s name=""
,MenuGetString(hm -i name)
,int hms=GetSubMenu(hm i)
,if hms
,,out s.format("%.*m[%s]" level 9 name)
,,sub.EnumSubmenu(hms level+1)
,else
,,int miid=GetMenuItemID(hm i)
,,out s.format("%.*m%i %s" level 9 miid name)
,
#8
THANK YOU!


Forum Jump:


Users browsing this thread: 1 Guest(s)