An App I use call Bear has a menu item I want to use but doesn't have a built in shortcut.
I know I could do a find image for "Note", a couple downstrokes, and then enter but I was wondering if there was a more elegant solution.
An App I use call Bear has a menu item I want to use but doesn't have a built in shortcut.
I know I could do a find image for "Note", a couple downstrokes, and then enter but I was wondering if there was a more elegant solution.
After much trial and error I frankensteined this code for my purposes from a apple script from Tom's answer to a somewhat similar question a couple years ago. It would be neat to have this run in the background without actually opening up the Menu but it's not of major importance.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application "System Events"
tell application process "Bear"
tell menu bar 1
tell menu bar item "Note"
try
with timeout of 0.1 seconds
perform action "AXPress"
end timeout
end try
end tell
end tell
end tell
end tell
do shell script "killall 'System Events'"
tell application "System Events"
tell application process "Bear"
tell menu bar 1
tell menu bar item "Note"
tell menu 1
tell menu item "Open In New Window"
perform action "AXPress"
end tell
end tell
end tell
end tell
set frontmost to true
end tell
end tell
Why not try using the Select or Show a Menu Item action? Here's an example showing its use with Safari:
jesus been using KBM for 8 months and had no idea that existed, thank you
We've all been there too!
Could you assign a keyboard shortcut to Bear in System Preferences>Keyboard>Shortcuts>App Shortcuts?
Hello,
I have a similar issue but with an agent (Connectix agent from Antidote) in the menu bar(upper right corner), it's not a running app.
I want to select the menu item.
I tried to use the locate picture and move the mouse cursor down. It works, but not always, so the resulting macro is not reliable.
Has anybody a hint?
Thank you,
Luc
Pl try what tiffle has suggested first above, and
a: not all applications are well behaved and give the truth to the API,
b: if it does not work try Zoom then Zoom (back) to kick it and see if that makes a difference. (Zoom or some other menu option that you can reverse)
The KM "Select Menu" Action can NOT access the non-App menus on the Apple Menu Bar.
I have a similar issue but with an agent (Connectix agent from Antidote) in the menu bar(upper right corner), it's not a running app.
Since this is Apple Menu is NOT from the frontmost app, but a "system" menu displayed by a process, you will need something like this:
This is for the "DropBox" process, so you will have to identify the process for your menu, and change the below script.
Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.
Please let us know if it meets your needs.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-~~~ VER: 1.0 2020-05-06 ~~~
Requires: KM 8.2.4+ macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))
Select Apple Menu Bar Item.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.
Note that you MUST UNCHECK the "Failure Aborts Macro" in the Gear menu of the Execute AppleScript Action, because the "with timeout" statement in the script will cause an error, but an acceptable error.
Hello @jonathonl,
Thank you but, @JMichaelTX is correct when he says herunder :
The KM "Select Menu" Action can NOT access the non-App menus on the Apple Menu Bar.
Hello @JMichaelTX,
First I need to tell you, I'm very unfamiliar with script, sorry.
So I opened the script in Km made the appName change and wanted to try the macro, but nothing happens. Tried to tinker with numbers in " tell menu bar item 1 of menu bar 2"
Did not show any reaction.
Here's a printscreen of the macro and script in KM, the highlighted agent name in activity monitor and the full menu and about for the agent in the menu bar.
Not sure what I need to do next. Hope it helps for guiding me.
Thanks.