Is there a way to check the status of a menubar item whether it's enabled or disabled? ChatGPT only gave me a script that returns true or false in the script result but I don't know how or where to save the returned value and use that for If condition action.
tell application "System Events"
tell process "Figma"
set menuItemEnabled to (enabled of menu item "Go to Main Component" of menu "Main Component" of menu item "Main Component" of menu "Object" of menu bar 1)
end tell
end tell
return menuItemEnabled
@Andreas_Hegenberg Hi, is there a better way to do this? I'm not sure I explained it very well. Determine if menubar item is disabled, then do this action. Otherwise, do this action. Stuff like that.
For example, in Figma, if I press a custom trigger — Opt+C and this menu item is disabled →
if you click the run button while BTT is frontmost, it will try to get the details from BTT‘s menubar. You can click the „run script“ button while pressing cmd, then BTT will stay in background
Hi! I'm not sure why but these past few days, the script doesn't always 100% work or unreliable when triggered. If I manually click the "Run script" button here, it would work as expected. But then after a few minutes, it's back to the issue.
Also, unrelated but if I check the "Run in background (limited support)" option, it turns off when I navigate away
I have BTT v4.769 and the process priority helper tool installed.
I also have the Ice menubar app installed, maybe BTT is conflicting with it?
ah electron apps have been a bit picky with this menubar stuff since macOS 14
For some users calling the function twice has worked (the first one would kind of wake up the process). Something like this
async function someJavaScriptFunction() {
// dummy call to wake up the menu
await get_menu_item_details("Object;Main Component");
let menuItemDetailsString = await get_menu_item_details("Object;Main Component;Go to Main Component");
let menuItemDetails = JSON. parse(menuItemDetailsString);
return menuItemDetails.enabled;
}
I see! I think this is what I've been meaning to ask, something to "wake it up". I will test but I think this is the best solution. I really appreciate you looking into it
Just to follow up, I've noticed that key sequences triggers work 100% most of the time but it's the keyboard shortcut and swipe gestures that don't. Why is that?
Weird, unfortunately then I have no idea. Some items change their name when option is pressed, which might explain the shortcut issue, but apart from that I can't think of anything.