58: Automating with TJ Luoma

So I got two takeaways from this episode:

  1. Bitbar
  2. There is mileage in the topic “How To Be A Better Automator”. Almost a pledge. (I could work this idea up into something.)

Oh, and a third: StreamDeck being updated by Keyboard Maestro. TIme to play. :slight_smile:

1 Like

This episode got me so fired up about the StreamDeck. David has been beating this drum louder & louder for a while now.

I’m now consumed by the idea of bending StreamDeck to my will for a streamlined Photoshop Retouching workflow. I already have SO MANY Photoshop keyboard shortcuts memorized, yet there are many more I should use but they just won’t stick in my brain, plus even more that don’t have shortcuts (by default) that should be accessable with a keystroke or two because they are indispensable for my own techniques.

I use a Wacom pen all day long and even after years using it, I HATE menu navigation via pen. I want to get the visual labeling of the Photoshop menu system built into keys. That is pretty much exactly what StreamDeck does.


Welcome to the side of goodness and light :slight_smile:

With Keyboard Maestro and KMlink there are not many repetitive tasks on the Mac that you can’t automate with the Stream Deck.


TJ - I know you alluded to this on the podcast, but why do you use KMlink instead of KM’s default integration?

Loved hearing you on the show. I’m still using the Stream Deck calendar plugin!

Thanks, Rich! I’m glad people are using it!

I use both KMlink and the official Keyboard Maestro plugin for Stream Deck.

Both have their uses.

KMlink’s big feature is that if you want to, you can move it from its original location just by dragging it around. This is how most Stream Deck buttons work.

By contrast, Keyboard Maestro’s official plugin works by being assigned to a specific row and a specific column. If you want to change it, you have to go and edit the plugin.

KMlink is a link to a particular macro, but you can move that link anywhere you want.

On the other hand, KMlink cannot do things like the calendar plugin. It’s just a trigger that tells Keyboard Maestro to run a macro, but Keyboard Maestro cannot send any information back to it.

So if you want a button to trigger a Keyboard Maestro trigger, try KMlink.

If you need something more complicated, if you want to set the button’s text or the image, you want the official Keyboard Maestro plugin.


In case it helps, I have a post about the Stream Deck / Keyboard Maestro plugin options and differences.

There’s also this related discussion that may be of interest.


Great article! I think I’ve read it before, but this time I noticed this:

  • Virtual Row - this is used by the Keyboard Maestro plugin to uniquely identify the button. If you are using the button in multiple folders and profiles across apps, you may find it is necessary to change the ID to avoid clashes.

So I never even realized that you can change the ID. Can you explain how that works? I’m starting to run into conflicts where the same button on different Stream Deck profiles will launch different KM macros.

(P.s. I think you were a victim of autocorrect “helping” you at one point in your article. Search for the word ‘suture’ and you’ll see what I mean.)

I’m also trying to work out how to reliably address buttons on a pair of Streamdecks: 2 x 3 and 3 x 5.

(A problem I can’t even have on Metagrid.) :frowning:

Okay. I did have a post from last December all about this, but I wasn’t happy with it at the time and it is still sat in my drafts folder. It went in depth on more than just this aspect as it covered some workarounds too, but let’s see if I can at least get the gist of the virtual layout and button IDs across.

Virtual Locations

As an example, I’ve set up a separate profile on my Stream Deck to illustrate how this works. You can apply this across profiles, but it also applies across folders - Keyboard Maestro is almost tesseract-esque in the way you can dimension various parts of it.

On the profile page I have three entries:


A folder and two links to two Keyboard Maestro macros. More on those shortly.

Under the folder, there are two more buttons. One has the same name as the Botton on the previous screen in the same position. The second one however does not.


On the root profile screen, the ALERT 01 button is set-up like this.


I’ve given the button a name, it can be anything I like. I’ve specified the virtual row and column coordinates as the defaults it gives. So row 1 because it is on the top row and column 4 because it is in the fourth column.

The macro I linked up links to this - note the device key references the virtual row and column:


Now ALERT 02 is set-up in a similar manner.


With a similar macro; again, note the device key.


When ALERT 01 is pressed I get a notification reading “Alert 01”. When ALERT 02 is pressed I get a notification reading “Alert 02”. Hopefully, that’s all straight forward and fairly familiar.

Now let’s look at the buttons in the folder.

The first one named ALERT 01 I’ve put in the same place as the previous ALERT 01, and I’ve set-it up almost identically (just a different ID). The physical location is irrelevant as that virtual row and column reference is what we’re using for linking, and it really is virtual. But, here’s how I defined the button.


When selected, this will display a notification reading “Alert 01” as it triggers exactly the same Keyboard Maestro macro as the other ALERT 01 button.

The ALERT 03 button is set-up differently.


The button is on physical row 2, column 5, but I’ve added an arbitrary ten rows to that and placed it on virtual row 12.

Then when I have a Keyboard Maestro macro set-up like this:


When I press ALERT 03 I get a notification “Alert 03” even though this button is in the same physical row and column location as the button that earlier triggered a notification of “Alert 02”.

My advice is to keep the virtual rows and columns related to the physical rows and columns if you are going to use them. It isn’t too difficult with a few rules and calculations to keep things in line for however you want to use it across profiles and folders … it just that you can have folders in folders in folders in …; so just make sure you have a plan from the start.

Button ID

I’m only about 20 minutes into this episode, so I don’t know exactly what is discussed yet, but this official plugin I would say is much more difficult to use than the KMlink plugin or even just using a macro’s URL trigger. The advantage the official plugin does have is that it allows Keyboard Maestro to use the button ID to dynamically update the button. That’s the ID, not the virtual location, and that’s where the button ID comes into play.

For example, let’s say I have three buttons set-up as follows:

Button A:

Button B:

Button C:

If I then create a Keyboard Maestro macro like this:


When I press button A, it will update the button with a button ID of “FOO” to have the stream deck icon that the macro has. But note that both buttons B and C have that ID. IDs, just like virtual locations do not have to be unique. Pressing the button will actually update the icon on both buttons.


The only pain is that I never found a way through Keyboard Maestro to efficiently update buttons periodically. i.e. only when the button is available on the deck. Also updating it when you switch into a folder or profile requires some tacky workarounds to force things which is a little disappointing. You can do this sort of thing through writing your own plugin (BarRaider does it on his Spotify plugin for example).

I hope that makes things clearer. Any questions, just let me know.


Hi folks, trying to make a Shortcuts Automation equivelant of the weekend App block on iOS here. When “Email” launch -> Check if it’s Sat / Sun -> If yes then give it an alert “Hey you shall rest” and launch “Netflix”.

I got the most part working, two remaining problems though:

  1. The below shortcuts is used to check if today’s Sat (value=7) or Sun (value=0); For now I check it first whether it’s Sat and then using another If to check whether it’s Sun. How can I complete the task within one If condition? I tried writing it like “If Formatted Date is 0 or 7”, it doesn’t work.

  2. I wish to have an “exit route” to use Email on weekends in case the flat is on fire. At the moment, whichever way I launch Email at weekends, the Automation will lead me to Netflix unless the Automation is de-activated. How can I jump out of this closed loop? Thanks!

For English, check the first letter of the day’s name.

There is no loop as such, you just need to insert a user driven condition.

This shortcut should illustrate a way to do both.


If you find the menu choice too tempting then your in case of emergency hurdle is simply to remove the automation associated with opening the email app.

Hope that helps.

This weekend trick works. Thanks!

I’ve tried the choose from menu method, now got stuck in another infinite loop:

Automation triggered when Mail App launched --> Menu appears for choices --> Choosing the Mail option nonetheless --> Switched to Mail, however triggering the Automation all over again --> Menu appears for choices

If your menu choice is choosing not to open another app, does it not continue into Mail without trying to open it a second time?

Another alternative (to manually disabling in Shortcuts) if you wanted to have a less disruptive approach, you could check for the existence of a file - e.g. if you have to work one Saturday you write a file with that date into the Shortcuts file area; or you could have a special entry in your calendar for the day. You could create a second shortcut to set those up, and in each case they would just be temporary overrides meaning you wouldn’t need to remember to re-enable as you would for the manual enable/disable via the Shortcuts app.

Hi TJ. I’m really excited to try this but my newbie-ness is getting in the way. How do I install the script into Bitbar plug ins? I promise I’ve googled and searched before asking here.
Thanks again for the great work

1 Like

Hey Danny

Don’t worry, we were all new at one time.

To add a new script to BitBar, you’d put a script into the folder that you’ve designated for BitBar’s plugins. The menu bar icon even has an option to open the folder right from the menu bar.

Once the file is placed into that folder, it needs to be ‘executable’ (basically to tell the computer “this isn’t a file like a text document, it has commands in it.”)

So let’s assume your Plugins Folder is named “Bit Bar” and it inside your “Documents” folder.

The easiest way to make them executable is to go to the Terminal.app (in Finder, go to “Applications” and then “Utilities” folder).

Launch Terminal.app


cd "$HOME/Documents/Bit Bar/"

(If your plugins folder is named something else, replace the appropriate names above.)

Once you have done that, you can see a list of the files (to make sure you are in the right folder) by typing ls -l (note that those are lowercase Ls where ls stands for list and -l stands for “long”)

If you have a file called “MyScript.sh” in that folder and want to use it in BitBar, you need to make it executable, so you would type:

chmod 755 MyScript.sh

Then, using BitBar’s menu item, you would want to choose “Refresh All” to get it to show up in the menu bar.


Now, having said all of that… what script are you trying to get into BitBar?


Thank you thank you! It’s the battery one.
I’ll get started on your stream deck ones right after that!
You can share with your congregation that you have fans in Israel too!

Great! Let me know if you have any problems getting it to work. Getting started with something new is already tricky.


When the Automation is triggered, I am already brought from the Mail screen to the Automation / Shortcuts App screen. The menu and selection also happens on the Automation / Shortcut App screen. If I chose none action for one of the menu, then it finishes and stays in the Automation / Shortcuts App; If I chose menue action going to Mail, then it triggers a new Automation

Are you on iOS14 yet? Did you try any of the non-menu options I suggested?

I love the upcoming calendar button! Question (because I can’t figure it out) - it keeps dinging over and over and it’s driving me crazy. How can I turn this off without disabling the macro or paying ransomware? :slight_smile: