Copying App Icons Using Keyboard Maestro

Content creators know that sometimes you’ve just got to focus up, hunker down and do the difficult work of writing. They also know that sometimes screw that.

I’m an advocate of “Productive Procrastination”. A selfserving rationalization of my laziness philosophy that says if you’re not going to do what your supposed to be doing, you may as well do something you can justify as somehome useful.

Recently, I was putting off a writing thinky philosophy post in favor of festooning my Apps and Utilities page with snazzy icons. Straightforward enough, I thought.

“I’ll just do a Google Image search for each app, find the icon…save it…hmm this is already looking tedious. I know! I’ll make an automation! The app icons are all already on my computer hidden within the app packages. I’ll just make a macro that copies their ICNS image file and then saves it as a new file!”

Let the following 12 minute over-produced screencast and post stand as testament to the fact that I DID NOT waste my time in manually finding and saving dozen or so images. The time it took to make all this crap doesn’t count towards the time savings. Automation will save you time and set you free.

Copying App Icons Manually

Like I said, since these apps are all on my computer, then I should just be able to copy the icon images.

Showing where app icons show up on mac

If you pull up the inspector, you can click on the icon and copy it to your clipboard, then go to, select “File > New Image from Clipboard” and save it as a PNG with whatever name you want.

That’s how to it works for a human, but it involves whole bunch of moving the cursor around, typing, thinking, and all that. Doing it once is fine, but a couple dozen is grating. I want to go full robot and use a Keyboard Maestro macro to get this down to one keypress.

The Macro

The macro I came up with is divided into five portions:

  1. Saving the Cursor Location
  2. Getting the App Name
  3. Getting the App Icon
  4. Saving the Icon
  5. Returning to Starting Postion

A Note on all the Pause Actions

MacOS has all sorts of animations. When you save something, a dialog pulls itself down from the top of the window and gives you your options.

Anigif showing what a "save animation" looks like

Read nothing into the fact that I recorded this on a Friday night

Nice to look at but it creates a short period of time in which no actions can be taken. Keyboard Maestro has a tendency to get a little ahead of itself. It’s trying to hit “Return” to save something, but the user interface isn’t done with its pretty save animation yet, so the macro jumps and everything breaks.

The pause actions are necessary to make sure that with all the switching around and animations, the Maestro doesn’t jump the gun.

Part 1: Save Cursor Location

Action: Set Variable to Calculation (Variables)

The cursor is going to move all over the place during this macro, but after everything is over we want it to return right to where it started so you can move to the next icon you want. This action saves the cursor’s inital position for later. Use this calculation to achieve this:

%Calculate%MOUSEX()%, %Calculate%MOUSEY()%

Save mouse location action

Part 2: Get the and Format File Name

This step executes actions that will get the name and make it lowercase (personal preference).

Copying app name

Full action set for copying file name

Step 3: Get App Icon

The inspector tool will show you all the detailed info for whatever file you’re looking at, including its icon. Since the inspector hovers above everything and changes depending on what file is selected, it will always show the icon in the same place.

This section of the macro moves your cursor to the icon, clicks on it, and copies it to the clipboard.

Copying app icon

Full action set for copying icon from inspector tool

Part 4: Create The Image in is MacOS’s stock image and document viewer. This part of the macro switches over to and uses the shortcum ⌘N to access the menu command “File > New Image From Clipboard”.

It then brings up the save dialog, pastes in the app name text from earlier and saves.

Pasted file name in save dialog

Full action set for saving an app icon image from clipboard in

Return to Starting Position

With the icon image saved, we’re ready to move onto the next icon. Remember saving the cursor position? Well now it pays off. First it switches back to your file explorer app and repositions your cursor to exactly where it had been in the first step.

Actions for switching back to file explorer and setting cursor location to original place

Still Not Done

We’re not entirely finished. This macro leaves you with all the icons files you want, but that’s no good for a website. Icons are saved in the .icns format, which is a package of multiple sizes of the same image. This is because MacOS serves up different sized icons for different things. Below you’ll see 5 instances of the same icon all in different sizes.

Showing where app icons show up on mac

Icons are everywhere!!!

“Wow very interesting.” You say. “It’s been like 800 words, could we finish up?”

Fine, jeez! Here’s how to convert all of them from ICNS to PNG in one action.

Use Automator to Batch Convert The Icon Images to PNG

Automator deserves it’s own post, so I won’t talk about it too much here. For now just trust this will do the job. You can download the workflow file and play with it yourself.

Automator is a native MacOS utility that allows you to automate various actions.

For this workflow, just drag your ICNS files into the “Get Specified Finder Items” pane and hit “Run”.

The workflow will go convert every ICNS to PNG format and resize them to 512×512 to cut down on the file size a bit.

Automator actions for batch converting images

Hit “Run” and voila! Presto chango, you’ve got a bunch of PNGs.


So did this save time? Not at first, but I’ve actually used this dozens of times since my initial app-icon-pull-athon. Was it more fun than performing tedious, repetetive tasks. I think so. The reward of solving a problem and building something was valuable to me. I learned about ICNS files, I found out effective ways to slow Keyboard Maestro to make the macro run smooth, I had fun creating the screencast.

In my opinion all that was better than being bored. That’s my journey as an empowered user. It is rejecting boredom and finding reward in buidling something for myself.

Leave a Reply