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.
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:
- Write an AppleScript that will read the KMTrigger selected in Evernote, and then open it.
- Use a macOS service like "Open URL"
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.
Iām not sure what you mean by that.
The kmtrigger IS a URL. It just uses a custom protocol.
Right, sorry, I switched lanes without signalling.
Hereās what I was thinking.
-
Enable KMās Web Server.
-
Configure the macro to have a Public Web Trigger.
-
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
Sounds like a great idea.
Iāve never used, or even explored, the KM Web Server.
Another whole world . . .
I just now used it for the first time, because I thought it might be a solution.
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.
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.
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:
NOW ! I understand. Thanks so much!
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,
crystal clear. thank you very much
@DanThomas, you are the man!
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!!
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! 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