I am a bit frustrated because I basically just want a macro to click on a menu bar app icon.
@Tom's macro is excellent and I am grateful, but for many apps (KBM, Copy'emPaste, etc) once I get the Bundle ID and run the macro below you can only see those apps where clicking on the menu bar item is considered the equivalent of 'Show Menu'. For many apps. what you see when you click on the menu bar icon is not considered a 'menu'.
I cannot click by position because the location of the menu bar items changes.
Would you have any idea how to create the equivalent of clicking on the apple menu item?
Hi @ronald, there are several factors to consider when using AppleScript.
The app you want to access must be able to use AppleScript!
At the place with the red arrow you always have to try if the app reacts to "1" or like here "2".
If you want to open the app and control it manually (arrow key), leave out the lower part of the script
If you have changing menu commands, you can replace "key code" in the script with the command "keystroke" and use the menu command "Cancel" as in my example. You have to pay attention to the correct spelling: