Keyboard Maestro Logo

Keyboard Maestro Tips from Bob Cassidy

Back in October, I told you about how I spent an inordinate amount of time trying to automate a way to remove the alpha channel from transparent PNGs. The problem I was trying to solve was that the icons I was using from The Noun Project for featured images on my blog posts were nearly invisible for people who favor dark mode in their social media apps. David Sheneman alerted me to the problem and I set about trying to find an easy way to make my PNGs non-transparent by removing the Alpha channel.

I could have simply opened the PNGs in Preview and unchecked the box next to the word “alpha” and saved the file, but that was too tedious for me when I could spend hours trying to automate the task.

In the article back in October, I explained that I tried a lot of different apps and methods to try to automate the removal of the alpha channel. I got really close using Keyboard Maestro but I ran into difficulties trying to figure out how to click the checkbox to remove the alpha channel in Preview.

After trying several other solutions, I ended up back in Keyboard Maestro, but I used a shell script that uses the open source library ImageMagick to remove the alpha channel. It was clever and it works flawlessly but I was still annoyed that I couldn’t figure out how to check that checkbox from Keyboard Maestro.

Shortly after I posted about this automation task, a lovely NosillaCastaway named Bob Cassidy sent me a beautiful writeup including screenshots on how to solve the problem all within Keyboard Maestro. I thanked him but didn’t have time right then to test out what he’d sent.

I created a reminder due the following day using a deep link to his original email so I wouldn’t forget to try it out. And I let a day go by, and another and another and pretty soon I’ve been ignoring that message to myself for four months!

Deep Link to Email in Reminders showing due date of October 27 2022
Deep Link to Email in Reminders Kept Getting Ignored

The good news is that I finally broke down and hit the deep link to bring up Bob’s email from October. My reminder didn’t even tell me what the email was about, just that it had something to do with Keyboard Maestro and it was from Bob Cassidy.

I read his instructions again, and finally gave it a try and it’s a very elegant solution to my transparent PNG automation problem. I’d like to share his entire email with you because it’s so well written and clear. Remember, the basic problem to be solved was how to check the checkbox to remove the alpha channel using Keyboard Maestro.


Allison, I’m an avid listener of your podcast and appreciate your enthusiasm for all things Apple. After listening to episode 911, I thought I could help out, so I’ve attached a Keyboard Maestro macro that, I believe, does what you want. Also, here are a couple of things I’ve learned about using Keyboard Maestro that helped with this.

I’ve given up on “Click at Found Image” after many unsuccessful attempts at using it, but have always managed to find a more reliable solution. Since most of my macros run on a server where the screen size and resolution never change, and there are macros to set window size, I can usually rely on things I need to click to always be in the same spot, so I can use the Move or Click Mouse action to click at a specific point in a window. That would be my last choice, however, as it relies on things always being in exactly the same spot.

In the macro I shared with you, I used the Press Button action to uncheck Alpha and to click on the Save button. You can even check to see if Alpha is checked and click it only if it’s checked:

Keyboard Maestro showing If Alpha Button is On Then Press Button Alpha
Keyboard Maestro Conditional Action to Press Alpha Button

In the screenshot I included for the conditional action, checking to see if the button is on shows (currently false), but if I make the Preview Export PNG screen active while still being able to see Keyboard Maestro, it will show (currently true) and I can see it change by clicking it on and off. That’s great for troubleshooting.

Another bit more complicated way to do this is to turn on “Use keyboard navigation to move focus between controls” located in System Prefs > Keyboard > Shortcuts > App Shortcuts. This lets you tab to most elements on the screen including the checkbox and typing space unchecks it. In the case of the Export PNG dialog box, it’s 9 tabs.

To create this automation in Keyboard Maestro, add the “Repeat” action, set it to execute the action 9 times, throw in a short pause, and then use a “Type Keystroke” action and have it simulate the Space bar.

Keyboard Maestro Repeat Actions 9 Times, tab, pause, type keystroke space
Macro Action to Repeat 9 Tabs Before Pressing Alpha Button

I think the ideal way to trigger this macro would be by right-clicking on the file and choosing from the contextual menu. In the back of my mind, I thought that Keyboard Maestro had that function, but after investigation, I don’t see a way to do it. If anyone knows how to do that, I would appreciate knowing how.

By the way, I always keep a Cancel Macro action at the end of all macros so I can easily copy and paste it into other places in the macro for troubleshooting.

Lastly, notice my liberal use of pauses, which I’ve found greatly reduces errors.

Hope this helps,

Bob Cassidy, Educational Technology Geek


I learned several things from Bob’s explanation:

  1. There’s a Keyboard Maestro action to press a button that you can call by name. I suppose the name could be something different than the visual label on the button but it’s a good starting point. One of the reasons I like knowing VoiceOver is that I can turn it on in an app and if the app is well-designed, VoiceOver will say out loud the name the developer gave it.
  2. Even if something doesn’t look like a button, it might be a button. The word Alpha doesn’t look clickable, but it actually is. I guess if you are hoping to access some text as a button, try clicking on the words to see if anything happens. I guess we have learned that checkboxes are buttons though.
  3. I learned that turning on keyboard navigation to move focus between controls let you force your way through an app’s interface in order to get to what you need. I also learned that turning on keyboard navigation to move focus between controls is really annoying. I’m used to using the keyboard to quickly navigate between interface elements and having it stop on every single field and button slows me down. Good to know the option could help though
  4. I learned that when you take four months to test something someone sends you, the operating system might change so much things aren’t where they said they’d be. Bob described where to find the keyboard navigation to move focus between controls option in System Preferences, but it moved up a level in System Settings in macOS Ventura. Now it’s in System Settings → Keyboard and then there’s a toggle at that level for Keyboard navigation.
  5. I learned that you can run Macros from the Keyboard Maestro menu bar icon. I did not know that!
  6. I learned that it’s valuable to add a “Cancel this macro” action at the bottom of every macro that you can slide up and down in the workflow to have it stop there for troubleshooting.

Thank you so much for all of this new knowledge, Bob!

For those interested, Bob included a copy of his Keyboard Maestro Macro for you to download if you like. One of the things I like about Keyboard Maestro is that imported macros are always disabled by default. This means you can look at them and understand what they do before letting them loose on your machine.

LINK TO BOB’S MACRO

1 thought on “Keyboard Maestro Tips from Bob Cassidy

  1. Bob Cassidy - March 1, 2023

    Allison, thanks for the kind words! Since you find “that turning on keyboard navigation to move focus between controls is really annoying”, you might try adding actions to the macro that would turn that option on when needed and then off right after. There’s probably some Applescript or something out there that would do that.

    I’m pretty obsessed with Keyboard Maestro, using it for many things, and really like learning how to solve problems with it. I recently found out a way to create an email trigger, so that when I receive a specific email, it triggers a Keyboard Maestro action. I use it so that when I receive an email that our local newspaper’s e-edition is posted a macro is triggered that downloads the pdf version and puts it in an iCloud folder because I really dislike the online viewer. Then I can read it on my MacBook or iPad or iPhone.

    In researching how to do that, I found a really neat YouTube channel here: https://www.youtube.com/@EzButtons with tutorials. Also, I highly recommend David Sparks’ MacSparky Keyboard Maestro Field Guide: https://www.macsparky.com/fieldguides/

    If anyone’s interested in the email trigger, let me know and I will try to help out.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top