I would like to create a macro which selects a menu item with a key pressed simultaneously.
In this case I need to select iTunes’ “Information”-menu while the option key is pressed.
Can anyone please tell me how to do this?
I was hoping for menu selection with modifiers for exactly the same thing. I was able to make a shortcut with cmd-option-I to select that menu and it does the trick for now.
In other apps, menu items that change with modifier keys usually aren’t so hidden. For example, if you select File from the Finder, try keeping the menu open, and pressing modifiers such as option and shift-option; all those commands I’d guess are unavailable through KM at the moment. Perhaps this can be rectified in the future.
What exactly did you do when you made "a shortcut with cmd-option-I to select that menu"? Did you only use KM?
I helped myself with an AppleScript using UI scripting and triggering it with ⌘I – find it below (keep in mind it uses German expressions for the menus).
Merry Christmas
Larry
tell application "System Events"
tell process "iTunes"
key down option
click menu item "Informationen" of menu 1 of menu bar item "Ablage" of menu bar 1
delay 1
key up option
end tell
end tell
Yes only KM. Just select the menu item and assign the shortcut cmd-option-I. Since option is held down when using the shortcut, it selects the menu with the option key.
That will work without the option key being held down.
You can try using the Press and Hold Modifier action before the select menu item, but whether that will work or not si still dependent on the application's behaviour.
I am trying to make a file open with a specific (not default) application, in Finder.
"Always Open With" and then the application.
Most of the times it does not work, i can't get my finger behind it. If i do it with my mouse the specific (but not default) application is sticked to the file, but with the KM action it is not.
Not quite. I’m holding down the OPTION key BEFORE I type the name of the desired menu item. I think this is necessary to ensure the item appears before trying to select it.
To be safe, you might even need to add a small pause (~0.2) AFTER the “Press and Hold the Option Modifier” Action, in order to give the app time to respond to the OPTION key.
Even then the application may choose to look at the hardware modifiers.
Of course, typing the "Lib" will release the option key. I believe it will then be re-pressed.
It's possible in @Fokke's final example, that simply using Type a Keystroke:Option-Enter would work, but probably better is the Press and Hold the Option key, Pause briefly, and then type Option-Enter.
A lot of this comes back to how the application handles the events: does it handle the event and then check the modifier, or does it watch for the modifier while the menu is open and adjust the menus, and when selected, based the decision on the current state of the adjusted menu.
I found this older post but it does not help me with the problem I am having.
The application I'm using expects someone to hold down the shift & control modifiers, then type the letter x while the shift & control modifiers are being held.
Just having Keyboard Maestro simulate the shift control x key combo doesn't work.
Nor does having Keyboard Maestro simulate and hold the shift control x key combo, pause one second, and then release the shift control x key combo.