Can Applescript Trigger a Conflict Palette?

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

to no avail...
I appreciate any input.

Rather than a conflict palette, why not use the Show Palette of Macros action?

As it's a macro in itself, it can be triggered in numerous ways, including by AS.

3 Likes

=), very nice~

Sort of curious why applescript wouldn't do it, but with your solution it doesn't really matter.

A good exercise in 'letting go' - so I thank you =)

1 Like

Well if "KP2" means "Keypad 2" your problem may be that KP2 (code 84) is not the same as the 2-key-whose-shifted-value-is-@ (code 19)

so much for letting go... =), all good...

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

Is there a way to move the mouse up from it's current position after the palette appears?
I have tried to no avail.

Thanx...

Well that's weird. Your code works for me. Try it again without that mouse.

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.