Execute a macro via a link in Evernote

The article does look very light on useful information.

The commands are not documented because they are not an API, and entirely subject to change.

People are welcome to use them, but documenting them on the wiki would be like documenting the XML of the Keyboard Maestro Macros - it would imply that they are a valid API and enforce backward compatibility requirements that I don’t commit to.

Using them on the forum on the other hand is perfectly fine, since it does not put a requirement never to change it on me.

As for how you figure out the URLs, its the same as any web site, you can see the URLs used in the links or address bar of the web server or by looking at the HTML.

Peter, as you say, the wiki provides little info an using the KM Public Web URL.
Could you please expand when you get a few moments?
We just had another question about this.

trigger:Public Web [Keyboard Maestro Wiki]

I would do it myself, but I don't have enough info to do so.

Thanks.

Can macros return a custom response after executing?

Of course. As the last Action of your macro, you can do a number of things:

  • Display a custom msg based on the macro results
  • Copy same to the clipboard
  • Display a notification
  • Send an email

What did you have in mind? The more details you provide us of your desired workflow to automate, the better we can make suggestions.

@JMichaelTX, thanks for the response!
Can a macro directly return a response to the http request?
The client would run a macro over http request, and get a result in form
of http response at the same time.
Then I can just return response data in json string.
Thinking about writing an iOS app, and this would be amazing!

I don't know. So I suppose you're wanting KM to behave like a web server, right?

It would seem that the primary purpose of the KM Web_Server trigger (KM Wiki) is to execute a KM Macro, which in general don't behave as a web server would. But I'm just guessing.

Perhaps @peternlewis can jump in here and clarify.

Why not just build a real web service? Since KM Variables are available through scripting, the web server could trigger a KM Macro, get the results in a KM variable, and return that to the caller of the web service. Just thinking out loud here.

@JMichaelTX, thanks again. That’s correct.
It would be complicated to package a web server and distribute.
It would be much simpler if KM supported this out of the box.
@peternlewis, any thoughts?
Thanks!

No, you cannot get a response from the macro through the web server.

The macro could send a response to another server, so potentially you could send a response back that way.

But you cannot simply hit a URL on the Keyboard Maestro web server and get any kind of response back other than “OK, I triggered the macro”.