First split up your PuM items into program categories ( e.g. browsing, email, Excel actions, etc.) and create a new PuM for each category. Now, make a new macro with the trigger you want (mouse or keyboard or second keyboard). What you're going to do is use the "getwintext" string function to get the active window's Tittle Bar text and then use the "sel" function to determine which PuM is brought up.
Here is how it is coded:
_s.getwintext(win())
sel _s 2
case "*- Mozilla Firefox"
mac "Menu3"
case "Quick Macros - *"
mac "Menu2"
case "QM Help"
mac "Menu"
This is pretty straight forward but I will make a few notes. First the '_s' is a predefined local variable for a string. There are also numerous other predefined variables but I mostly use _s and _i (integer). It saves a line of code by not having to declare it. The '2' after 'sel _s' is a flag that tells QM that the values in the select case will/may contain wildcards. You can also tell QM that the case statements need to be case insensitive with the flag 1. Or, you can tell QM that the case statements are case insensitive AND may contain wildcards by adding the flags together and putting a 3 there.
So there you have it; one macro to rule them all using 'Macro Stacking'. Now you can make all kinds of PuMs without having to sift though all the macros/code or Sub-menus that don't apply to the situation at hand.
So have at it and I'll see you next time cause the hook always brings you back.
Lesson 2:The Pop-up Menu
No comments:
Post a Comment