Hey Guys,
Don't forget this new feature of Keyboard Maestro 10:
It's much handier for most things than the “Paste” status-menu-item, unless you're very mouse-centric and/or need the hidden capabilities of:
⌥
or
⇧
or
⌥⇧
The best way to open the Keyboard Maestro status-menu hands free is to use a variation of this AppleScript:
--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2015/11/28 05:19
# dMod: 2021/11/30 02:33
# Appl: Keyboard Maestro Status Menu & System Events
# Task: Open Keyboard Maestro Status Menu
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @System_Events, @Open, @Keyboard_Maestro, @Status, @Menu
--------------------------------------------------------
tell application "System Events"
tell UI element "Keyboard Maestro Engine"
tell menu bar 2
set kmStatusMenuPosition to position of menu bar item 1
end tell
end tell
end tell
set kmStatusMenuPositionX to (item 1 of kmStatusMenuPosition) + 15
set kmStatusMenuPositionY to (item 2 of kmStatusMenuPosition) + 10
set kmMacroXML to text 2 thru -1 of "
<array>
<dict>
<key>Action</key>
<string>Click</string>
<key>Button</key>
<integer>0</integer>
<key>ClickCount</key>
<integer>1</integer>
<key>DisplayMatches</key>
<false/>
<key>DragHorizontalPosition</key>
<string>0</string>
<key>DragVerticalPosition</key>
<string>0</string>
<key>Fuzz</key>
<integer>15</integer>
<key>HorizontalPositionExpression</key>
<string>" & kmStatusMenuPositionX & "</string>
<key>MacroActionType</key>
<string>MouseMoveAndClick</string>
<key>Modifiers</key>
<integer>0</integer>
<key>MouseDrag</key>
<string>None</string>
<key>Relative</key>
<string>Absolute</string>
<key>RelativeCorner</key>
<string>TopLeft</string>
<key>RestoreMouseLocation</key>
<true/>
<key>VerticalPositionExpression</key>
<string>" & kmStatusMenuPositionY & "</string>
</dict>
</array>
"
ignoring application responses
tell application "Keyboard Maestro Engine"
do script kmMacroXML
end tell
end ignoring
--------------------------------------------------------
I run this from FastScripts, so all of the Keyboard Maestro actions are encapsulated as XML and run with do script.
It can run as-is in an Execute an AppleScript action, or you can use just this part of the AppleScript:
tell application "System Events"
tell UI element "Keyboard Maestro Engine"
tell menu bar 2
set kmStatusMenuPosition to position of menu bar item 1
end tell
end tell
end tell
set kmStatusMenuPositionX to (item 1 of kmStatusMenuPosition) + 15
set kmStatusMenuPositionY to (item 2 of kmStatusMenuPosition) + 10
You'd then send those AppleScript values to Keyboard Maestro variables, and from there use a Move or Click Mouse action to actually click at the menu position.
This method prevents the hang of the native KM Show Status Menu action and other techniques.
-Chris