Logic Pro Menu Item Condition

I'm testing a seemingly very simple macro in Logic Pro that checks for a menu item "Hide Editor" then selects that menu item if it exists and does nothing if it does not. The goal is to simply close the editor window if open and do nothing if it is closed. But I seem to be running into a few problems with it.

It doesn't seem to matter whether the menu item current displays "Hide" or "Show" Logic treats them in the same way. In fact when I look for the Hide menu item, it doesn't actually exist so I've tried changing it manually to Hide but that doesn't seem to work. Seemingly regardless of whether I search for Hide/Show, KM finds the same menu item. I tried "with name matching" as well, but that didn't change the macro's behavior either. I'm wondering if there is some sort of way of searching for an exact string in menu items. Or if anyone knows of any simpler ways to accomplish this I'm up for suggestions.

I have a similar macro I'm working on for closing any plug-in windows if open and would prefer to do this through menu commands as it seems more reliable but with this macro as well I've resorted to Found Image.

Thanks

Hmmm...in fact playing around with it here I feel like I'm experiencing some odd behavior with using the menu items in general and that perhaps I don't understand them correctly. I've simply add a Select Menu Item action and selected Show All Plug-in Windows, however when I trigger this action it does the opposite, it only Hides open plug-in windows. The opposite is also true. When I modify the menu item manually (because hide is not in the list) to read Hide All Plug-in Windows and trigger the action it only Shows plug-in windows. I'm little confused

I'll keep chipping away here and trying to troubleshoot but if anyone has any ideas or ways of troubleshooting I'd appreciate it.

I'm not sure, but did you read the following page especially the part which says, "The Select Menu action allow you to specify multiple options separated by a vertical bar (eg Show|Hide) to allow for toggling or varying menus."

https://wiki.keyboardmaestro.com/action/Select_or_Show_a_Menu_Item

There's another relevant statement in there that says:

"Alternatively, you can start the name with an ^ and use a regular expression to match the menu."

... so I suggest you start (and end) the word "Hide" with a "^" (and "$") to see if there's any difference.

Thanks for the reply! I've tried this and ^Hide$ All Plug-in Windows. Neither seemed to work...

Logic doesn't update the state of many of its menu items until the user views them, meaning that using them in conditions requires a bit of hackery.

You have to trigger the parent menu first, then perform the conditional check.

Select menu action: View
Simulate keystroke: Escape

Now the menu item will be available for conditional checks.

Is this what you meant? It seems to be working anyway. I didn't know you didn't need to fill in the Menu Item portion of the Show Menu Item action

Cheers again!

1 Like

By the way it seems to be working without the ESC key. Do you think it's best to key this in?

Actually yup I think you're right. When multiple actions like this are added the macro seems to get held up in the menu titles when ESC isn't inserted

1 Like

Yes, double-triggering the parent menu like that allows you to evaluate a menu item state properly. In my experience, pauses aren't necessary. :+1:t3:

@noisneil Indebted! I hate to ask but I'm going to. Any thoughts on how to do this sort of thing for the Track Inspector? I'm hoping to use Art Conductor presets but the only way they work for some reason is if the Track Inspector window is open. My action for this, obviously, involves a search for image bit. I feel like it's not very reliable

I've just disabled all other actions to isolate this one and see if it's working as expected...and it is not. Every time I push the MIDI CC trigger the track inspector seems to be opening/closing for some reason

Actually, I crisped up the image slider and it seems to working a bit better now. Still if you have any other solutions I'd love to hear them

And @noisneil I've gone back to my first post where you linked a bunch of macros you've made. Looking through those, doing a bit of homework. Great way to learn this stuff

There are a bunch of macros in that thread that automate opening the inspector via an AppleScript submacro. I think the fades macros might be one, so you should be able to incorporate it into your macro.