I’ve read the instructions for creating plug-in action with a shell or AppleScript, is there a way to build a plug-in action with compiled code? Can I include an executable in my .zip and then call it from the shell script?
Yes you can; I’ve done that very same thing where I use an executable that’s bundled with the remainder of the plug-in files in the zip. The first time I ran the plug in I had to give the system permission to run the executable but after that it works with no problems.
I’m not sure what you mean by ”Binary API” though in connection with plug in actions.
I mean like, can you dynamically link to KM and have your code (in Swift or whatever) call and be called by it?
I think what I’m going to do is just write a command line program and then give the user an installer for it.
I get it. I haven't seen a way of doing that. My route was to implement compiled apps that take parameters from the command line which the plug in could then call via AppleScript/shell etc.
No. Nothing compiled.
What you can do is run an XML version of a macro with the .doScript
(AppleScript do script
) method of the Keyboard Maestro Engine scripting object, calling your script with an osascript
command line.
In the Keyboard Maestro Editor, see Edit > Copy as XML
Forgive me – I misread your question. You can't compile KM macros, but you should, I think, be able to find a way of making use of your own binary, or a third party binary utility installed with brew
etc on your own system in a plugin, even if only called with an Execute shell script
action.
Distribution is another matter.