I have a conflict palette that is triggered by Option+Command+KP2.
The triggered macros are not in a group by themselves, all of the macros triggered by that key combination are within a larger group of macros.
I have tried a number of approaches and it will work maybe once, but then not at all.
I have tried:
tell application "System Events"
keystroke "2" using {command down, option down}
end tell
and
tell application "System Events"
set theApp to ((path to frontmost application) as text)
tell application theApp
tell application "System Events"
keystroke "2" using {command down, option down}
delay 1
end tell
end tell
end tell
and
tell application "System Events"
set theApp to ((path to frontmost application) as text)
tell application theApp
tell application "System Events"
option key down
command key down
delay 1
"2" key down
delay 1
option key up
command key up
"2" key up
--display dialog "Control and Option and Command keys are now up" buttons {"OK"} giving up after 5
end tell
end tell
end tell
following works like a charm in script editor, also works when using the 'try' on the individual action within KM, but it doesn't work when I run the macro with the trigger - so it may be something to do with the script that it's in (a Hotkey / USB Key by @noisneil, or to do with the trigger I'm using, which is a Kensington Expert Trackball + modifier keys)
tell application "System Events"
set theApp to ((path to frontmost application) as text)
tell application theApp
tell application "System Events"
key code 84 using {command down, option down}
delay 1
end tell
end tell
end tell
well there ya go... at first it didn't work again, then I put a .1 delay before the applescript and it worked, then I took the .1 delay out and it still works....
go figure....
thanx for the time and effort...
Edit:
After a little more investigation.
If the trigger is held down for the slightest bit after triggering, it errors.
If you let go quickly, it works fine.