Execute a macro via a link in Evernote

Hello,
Is it possible to execute a macro via a link in Evernote, Apple Note, Scrivener, Pages, etc?
thanks in advance for your advice

Yes. See this Wiki Article. Treat it just like you would any other URL and, depending on the app, it should work just fine.

2 Likes

thanks very much. Not sure what I should put in as ‘value’. There are no values or variables to pass. Just imagine something simple like opening the KBM forum.

thanks again. I am not sure I understand the syntax
If my macro is called
URL Keyboard Maestro FORUM
which actives chrome and puts me in the KBM forum
what would my link look like ?
thanks

From the KM Wiki:

kmtrigger://macro=MacroName&value=Value

Just substitute the name of your macro for "MacroName".

"value" is an optional parameter you can pass to the Macro.
Since you don't have one, just leave out "&value=Value"

Of course, since this is a URL, it must be URL encoded ([SPACES] not allowed).

So, your KM Trigger URL would look like this:
kmtrigger://macro=URL%20Keyboard%20Maestro%20FORUM

However, this custom URL protocol will NOT work in Evernote since Evernote does not support custom protocols.

The only workarounds I know of are:

  1. Write an AppleScript that will read the KMTrigger selected in Evernote, and then open it.
  2. Use a macOS service like "Open URL"

1 Like

What about using some sort of KM Web Trigger? I haven’t looked at this KM feature at all, but I know you can trigger macros from a URL somehow. Perhaps something like this could work?

Just a thought.

1 Like

I’m not sure what you mean by that.
The kmtrigger IS a URL. It just uses a custom protocol.

1 Like

Right, sorry, I switched lanes without signalling. :smirk:

Here’s what I was thinking.

  1. Enable KM’s Web Server.

  2. Configure the macro to have a Public Web Trigger.

  3. Then you can use a URL like this:

http://127.0.0.1:4490/action.html?macro=8F5FB878-99F0-4F95-9A07-8D6AF9AA2449

or

http://127.0.0.1:4490/action.html?macro=8F5FB878-99F0-4F95-9A07-8D6AF9AA2449&value=parameter
1 Like

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:
kmtrigger://macro=MacroName&value=Value
If I understand correctly, I can ignore &value=Value if I do not want to pass a value, but how do I write
kmtrigger://macro=MacroName
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:

05AD9384-E8F1-479C-A6C0-209CE7A963DA

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 ~~~

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


###ReleaseNotes
: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:
http://127.0.0.1:4490/action.html?macro=<YourMacroUUID>&value=<TheURLYouWantToOpen>

For example:

http://127.0.0.1:4490/action.html?macro=1238B406-69B6-4093-8E59-85431F7483AD&value=/Users/Shared/Dropbox/Your%20File%20Name.txt

1 Like