95: Keyboard Maestro Takes It Up to 10

4 Likes

Perfect timing, thank you :blush:

3 Likes

For me subroutines are also the best new KM10 feature, but displaying macro groups in the menu bar with a custom icon/title is a close second best. I used that feature to create a build monitor in my menu bar (super useful when working from home, due to pandemic measures).

menu bar

I like the suggestion of giving more attention to PopClip and BetterTouchTool, even if that won’t fill an entire episode. Looking forward to getting tips on how to use them better/more!

3 Likes

Another great episode, @MacSparky and @RosemaryOrchard. You two are the best! Thank you so much for everything you do for the Apple community.


If you have purchased Keyboard Maestro, but haven’t visited the Keyboard Maestro Forum, do yourself a huge favor and come on over. It’s a very friendly place filled with smart and generous users—newbies to pros. Also, the KM Developer, Peter Lewis, participates frequently.


I chuckled a little bit during the episode when this frequently required text transformation came up:

local_SomeVariable --> %Variable%local_SomeVariable%

I think Rosemary mentioned that she uses PopClip to do it; and David said he uses TextExpander.

Don’t get me wrong, I’m very glad David and Rosemary use and discuss many automation tools, but as a regular old user, I’m attempting to consolidate and use Keyboard Maestro whenever possible.

(I say that, but Typinator comes up often on the KM Forum, and I just asked one of the users his rationale for using both. Let’s face it, it’s hard to resist some of these cool automation tools.)

But back to the text transformation…

Keyboard Maestro, itself, can be used for the text transformation—but there are a few subtleties. I do it often and have shared a macro that can do it and many other transformations: MACRO: Augment or Filter Text, v2.2

I had put together a silent demonstration video and ironically the last demonstration includes the above transformation.

5 Likes

I like the suggestion of giving more attention to PopClip and BetterTouchTool, even if that won’t fill an entire episode. Looking forward to getting tips on how to use them better/more!

I too think an episode devoted to small tools like these two would be of interest.

Other tools could include Default Folder X, Fast Scripts, Menuwhere, LaunchControl, and Rocket, a few I’ve found useful. Focused tools which enhance the experience of using my Mac.

I’ll sure others will have suggestions as well.

And thanks for another interesting and informative episode.

I noticed that David used “they” and “the team” to refer to the developer(s) behind KM.

My impression was that this was a solo job (Peter indeed). Did that change?

1 Like

Me too. If it has changed, it’s not evident on the KM Forum.

1 Like

Judging from the Stairways Software History page, the company consists of multiple people. It is not clear how many might work on KM.

@RosemaryOrchard, I’m sure you don’t need any help getting started with custom HTML prompts, but here are two I’ve done in the last few months. I can’t get enough of these things!

Standard JS fetch; enter to paste result

YouTube KM

Fetch with custom Cmd K palette

image

3 Likes

On the subject of smaller apps that deserve attention, FastScripts is wonderful and was recently updated. Maybe pair that with Script Debugger? The latter is definitely not a small app but these guys are keeping AppleScript alive and kicking despite Apple’s neglect. See also Shane Stanley’s AppleScript libraries, which add a huge amount of power that is otherwise lacking.

1 Like

This is an off-topic question triggered by @MacSparky mention of using Apple’s six colors and I was wondering what are the six color details?

A reasonable position. Become fluent in a tool that fits one’s working style and meets their needs.

But one can also make the argument of using the best tool for the job. Was it in this show that Rosemary mentioned that a carpenter would have several different types of hammers? Not to mention (which she did not) saws, and pliers, and screw drivers, and … you get the idea. :slight_smile:

And best tool will vary by each person’s background and skill set.

And some folks just like trying lots of different things. Where for “trying” read “playing with” and for “things” read “toys”.

Where as others just want to get a job done and move on.

1 Like

I haven’t had much of a deep dive into KM 10 yet (though the couple of times I’ve made use of the new subroutines I’ve really enjoyed!)

However in relation to the discussion around triggers I want to call out the ‘Trigger Macro by Name’ action. I’m not sure whether it was built in, but I have a KM macro that contains just this action assigned to HyperKey + K and it simply pops up an Alfred-style box where you can type in the name of the macro you want to run. I find this works better for my brain than trying to manage/remember too many keyboard shortcuts, especially for those lesser-used automations.

Also worth noting: @sylumer also has his helpful Conductor workflow for Alfred which works in a similar way - the only reason I prefer the built-in option is because it filters the list based on what’s available in the current application.

2 Likes

A great episode. I ended up with 3 notes in Drafts - which will turn into 3 tasks in OmniFocus:

  • StreamDeck / Keyboard Maestro dynamic button icons
  • Window Title as part of trigger in Keyboard Maestro
  • Long press trigger in Keyboard Maestro 10

So plenty of food for thought. Thanks!

1 Like

I’m really new to Keyboard Maestro but not so new to the usage of subroutines and how valuable they are.

What is and how do you create a subroutine within Keyboard Maestro?
I assumed a subroutine was just another macro (already created), so I added the action ‘Execute a Subroutine’ but it wouldn’t allow me to select any?

As I said, total newbie to KM so any help would be great.
Thanks.

1 Like

Subroutines are other macros, just as you’re thinking.

Prior to v10, you could call one macro from another. But you couldn’t easily return a value to the calling macro, and you couldn’t easily pass multiple arguments to the sub-macro when you called it. (There were hackish work-arounds, but ick.)

With v10 you can define a macro as a subroutine by assigning the “subroutine” trigger to it. It’s still a regular macro in other respects. But now you can identify one or more variables to receive arguments from the calling macro. In the calling macro, you’re prompted to provide the named arguments.

You also have the option of returning a single value from the sub-macro back to the caller.

This should all be in the manual and the forum wiki. Have fun with it.

2 Likes

@arasmus covered the details about subroutines. Here is the wiki link for the Subroutine trigger. Use it with the Execute a Subroutine action.

2 Likes

So you’ve got custom “amount” metadata going from Hazel to Devonthink @RosemaryOrchard, I’ve done the same thing too! I am also really close to tying it to YNAB to create a new transaction via the API when I scan a new receipt, seeing that I can map the Payee, Date, Amount, Account, Category, etc. Useful if Bank Sync isn’t supported in your country yet,

All this raises an interesting topic. Where and how do we share all of our cool Keyboard Maestro automations? I’ve been thinking about setting up a repo on GitHub, even just for the JavaScript code that runs to do the integrations between Hazel, Keyboard Maestro, YNAB, Toggl, Todoist, running a shell script to perform a curl request to hit an API etc. It feels a bit naff and elitist to send people off to your own personal repos at GitHub though. :thinking:

How are other people sharing their work? There are so many forums, like Automators, MPU, Keyboard Maestro, DevonTHINK, Drafts, Hazel (is that really a forum though), Obsidian, OmniFocus, etc. It’s probably easier to manage for content creators to link back to their own GitHub account. At least we are spoilt for choice as automators :slight_smile:

2 Likes

Really good deeper dive on a specific app with this episode. I’d be up for more like this every once in a while :slight_smile:

PopClip and Better Touch Tool

As noted in earlier posts, there was some question as to if these tools could form an entire episode or not.

Well, for Better Touch Tool, that could so easily fill several expisodes in terms of the potential use cases, trigger types, automation features and even to the point of looking at approached like GoldenChaos-BTT. To me it is reminiscent of Keyboard Maestro in terms of the hidden breadth of functionality it has. I would imagine it would be more a case of what to leave out or whether to do multiple episodes than could it fill one.

Though I guess I might be one of the few who misses its Leap Motion support - I used to control Spotify with conductor-esque swipes through the air using that set up :laughing:

PopClip I think could fill an episode too, but would certainly be harder to do than for Better Touch Tool. The basic premise is simple to cover, but there are many extensions that it can utilise that could be talked about, and perhaps some discussion of when and why you might use (or not use) PopClip versus other automation tools. I think that is something that comes up a lot in that people frequently ask on the forum about choosing the right tools. That could be talked about here, though I suspect that the factors in choosing the right tools could even be fleshed out into a full episode of its own.

I keep PopClip running but disabled by default, but every now and then I’ll be doing some coding/scripting and enable it for some of the handy developer tools on offer, or if I’m working though something where I need to do a few translations to a different language. I tend to find other tools scratch an automation itch more frequently or the ways I work, but when it hits the spot for something, PopClip does so flawlessly.

Keyboard Maestro and Shortcuts

Rosemary noted the option to execute Shortcuts shortcuts from an execute script action. But, just as a reminder, I created a convenience plugin for Keyboard Maestro to abstract the need to know the command line stuff.

Keyboard Maestro Variables and Trigger URLs

Rosemary also mentions in the episode about using PopClip to populate variable names with the Keyboard Maestro token format. I have used something similar for a while, but that is Keyboard Maestro macro based. I had recently revised it to use a formal subroutine (rather than just an execute macro) approach. if anyone is interested you can download a Keyboard Maestro macro group containing these here (my actual Keyboard Maestro macro group has a couple of additional macros in it, but these ones get the most use).

The group has five keyboard shortcut triggered macros; triggered by CTRL+V (^v), and a subroutine macro.

2022-02-19-19.04.48

When the shared keyboard shortcut is pressed it displays a conflict palette - you can then use g / i / l / p / s to trigger the desired macro.

2022-02-19-19.06.22

These will then trigger the subroutine. If there is text selected, that text will be used as the base name for the variable. If there is no text selected a select all will take place and that text will be used as the base name for the variable. If there is still no text, the user is prompted to enter the as base name for the variable.

If global is selected, just the basic variable token text will be wrapped around the text and inserted. If instance, local or password, then the appropriate classifier text will also be inserted. If shell is selected, then the “$KMVAR_” text for using a Keyboard Maestro variable in a shell script will be inserted followed by the base varibale name.

Maybe these will be of use to anyone dabbling in Keyboard Maestro?

Rosemary also mentioned having a PopClip extension to build a trigger URL from a macro UUID. Well, if you happen to be using my Alfred workflow for Keyboard Maestro (Conductor), it might be useful to know that if you type in the text for triggering a macro, but hold down then CTRL key, then it will copy the trigger URL to the clipboard

2022-02-19-19.17.46

In the screenshot above, I’ve typed in the trigger query, and when I hold down the CTRL key, the subtitle beneath the macro changes from the macro group and UUID to the text about copying the trigger URL to the clipboard.

For completeness, holding down OPT will open the macro for editing, holding down CMD will copy the name of the macro to the clipboard, and without any modifiers, the macro will be executed. Note however, that these only work with the direct macro trigger. The keyword to trigger the macros after a delay (;km) does not support this.


Hopefully, some of these thoughts and extras will be useful.

6 Likes
1 Like