Trigger Macro by Name action - Passing Parameters Part 2

A quick tip for some.

Sometimes @peternlewis hides jewels in plane sight. If you are like me, sometimes you catch them and sometimes you don't.

In this case, it's the power of the Trigger Macro by Name action as it relates to passing parameters. This Forum thread touched on it. However, I'd like to give a tag use case example (Tagit), then show another way to perform what was in the above thread and, lastly, show search example using the Bing search engine.

Tags are often discussed in the forum. Here is a quick example how I do add tags, to files, using Trigger Macro by Name action and passing the parameter using the "//" after the macro.

First: This macro is called Tagit.

Purpose/Usage: The Tagit macro was created to demonstrate the power of the Trigger Macro by Name Action, accompanied with a passing parameter, while using the β€œ//β€œ mechanism. The parameter works via the Trigger Value Token.

This example is a simple tip to tag (or remove tags from) selected Finder files.

To use, select the file(s) in your Finder, spawn your Trigger Macro by Name hotkey and type the name of your macro (in this case) Tagit//Blue, for example. The selected file(s) will be tagged Blue. You can use any name you would like after the //. If you type Tagit// without a parameter, the tags will be removed.

Tagit.kmmacros (10.4 KB)

Here is the macro Image

For the Forum Thread - Tip: Passing Parameters From Trigger Macro by Name

An alternative way of performing the same would be to use the Trigger Macro by Name action with the // and type in your time in seconds, without using the regex. In my case by typing -- Timey//30. This would give 30 seconds. The difference in script is below:

Image of the actions using the Trigger Macro by Name "//" utilization

Lastly, another quick example is if you wanted to do a web search.

This one is call Bing it. So I would spawn the Trigger Macro by Name hotkey and type Bing it//Keyboard Maestro. The Bing URL searching Keyboard Maestro would appear.

Here is the macro.

Bing it.kmmacros (6.1 KB)

Here are the actions

I hope this makes sense and it's beneficial for those that don't use this powerful yet simple feature. It's been around since Keyboard Maestro 8.0 and I use it constantly but never see anyone truly discuss it. I thank @peternlewis for this brilliant feature.

11 Likes

This is AMAZING! I had no idea it even exists! From the Wiki article:

Passing Parameters

You can pass parameters (v8+) to the macro via the %TriggerValue% token by adding // and then the parameter to your search string. The // and anything after that will be ignored in the search.

I wonder how many other people don't know about this? In fact, I'll bet there's WAY more people who don't know this, than do.

Thanks @kcwhat for this great find! And of course, thanks to @peternlewis of course, who continues to show his brilliance day by day.

5 Likes

@DanThomas - My pleasure. I just started using this technique back in August 2021 and it had been around for over 4 years. I remember when I read it, I was like what???!

Good question. I have no idea how many folks use this or the many ways they use it - if they do. Makes me wonder how many other simple tricks that people use to get things done. We are so enamored with the complex but, to me, it’s the simple usage that delights me most.

KC

2 Likes