Execute a macro via a link in Evernote

Sounds like a great idea.

I’ve never used, or even explored, the KM Web Server.
Another whole world . . . :smile:

1 Like

I just now used it for the first time, because I thought it might be a solution. :slight_smile:

I can see one issue right away - it opens a browser window. So I’m guessing this isn’t ideal. But my mind is whirling, trying to imagine a way around that. I’ll let it simmer and see if anything comes to the surface.

For instance, the macro could close the browser window (tab).

Or perhaps something else.

1 Like

How do you handle macroname when the macro name has spaces in it? thanks very much

%20 instead of name. Or use “Copy as UUID” and use that instead.

1 Like

I am very sorry Don, I still don’t understand.
Let’s say that my macro name is as below
open XYZ restaurant menu
note that the macro name includes spaces
how would you write:
If I understand correctly, I can ignore &value=Value if I do not want to pass a value, but how do I write
if the macro is named as above
Sorry once again for taking your time, and thanks

I already answered that above:

1 Like

NOW ! I understand. Thanks so much!

A post was split to a new topic: How Do I View PDFs and Take Notes with Evernote?

what does UUID mean?
thank you

It means something like “Universal Unique Identifier”, at generally looks something like this:


It’s guaranteed to be unique across all devices in the world (there’s a couple of exceptions to this, but for all intents and purposes, it really is).

KM uses the UUID internally to identify Groups and Macros. That’s why you can have macros or groups with the same name - to KM, they’re different because they have different UUIDs.

For Keyboard Maestro macros, you can get the UUID by using Edit->Copy->Copy as UUID.

So if you ever use something like the “kmtrigger://” feature, it’s best to specify the macro UUID rather than the macro name. This way there’s no problems with duplicate names, and if you ever rename the macro, it won’t break anything.

Probably more info that you wanted, but there you have it,

1 Like

crystal clear. thank you very much

@DanThomas, you are the man! :grinning:
I would never have figured out how to do this without your post.

@peternlewis, the KM Wiki article on "Web Server" is woefully lacking.

  • It does NOT provide any of the commands (like "action.html"). Are their others?
  • I would update, but I don't know enough.

I just implemented this, and it works great!! :thumbsup:

Here's my new macro, that has NOT had much testing or use yet, so if anyone wants to use it, you do so at your own risk.

###MACRO:   @Web Open URL Passed from KM Web Server

~~~ VER: 1.0    2017-02-01 ~~~

@Web Open URL Passed from KM Web Server.kmmacros (4.5 KB)

:warning: Warning! This uses the KM Public Web Entry, which may have some security issues. See KM wiki for details.

The KM Web URL is like this:<YourMacroUUID>&value=<TheURLYouWantToOpen>

For example:

1 Like

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.


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?

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”.