Page 1 of 1

invoking a macro with a key command

Posted: Thu Feb 16, 2017 3:41 pm
by adventuresofgreg
Hi: I'm trying to send a keyboard key to my system:

ie: "type "m" with commandkey

to fire a "Keyboard Maestro" macro, and can't seem to get that to work.

If I type "m" with commandkey from anywhere, the macro is fired off, but when I do that from a LiveCode script, Livecode seems to trap the message internally (ie: "command "m" is typed into whatever field is currently selected)

??

Re: invoking a macro with a key command

Posted: Thu Feb 16, 2017 4:55 pm
by dunbarx
Might Applescript help here? You can "do" a handler as "applescript", if Keyboard Maestro is compliant.

Craig

Re: invoking a macro with a key command

Posted: Thu Feb 16, 2017 5:08 pm
by adventuresofgreg
Hi Craig:

I tried this and it did not work:

a field called "ascript" with contents:
tell application "System Events" to keystroke "m" with command down

button script:
do field "Ascript"

Re: invoking a macro with a key command

Posted: Thu Feb 16, 2017 7:24 pm
by dunbarx
I am no AppleScripter. But I bet that is the best, if not only way.

Anyone else?

Craig

Re: invoking a macro with a key command

Posted: Thu Feb 16, 2017 7:51 pm
by adventuresofgreg
go it!

You have to ADD "as Applescript" after your script.

do tScript as Applescript