Six Colors
Six Colors

by Jason Snell & Dan Moren

This Week's Sponsor

Unite 5 - Turn Web Apps into Supercharged macOS apps

By Jason Snell

Keyboard Maestro comes through again


It’s been more than a year since I extolled the virtues of Keyboard Maestro so I think I’m allowed to repeat myself.

Today I needed to shut down the Six Colors Slack for members. (We moved to Discord; join us!) But Dan and I use that Slack to communicate and collaborate with others. So I didn’t want to delete it—just remove all the members from it.

Easier said than done. Slack doesn’t offer any tools to batch-deactivate users, so far as I can see. (Pity the poor corporate IT person who has to deactivate loads of people after a layoff, I guess…) You have to do it manually. Which requires going to Slack’s user list and then clicking on a button next to a user, clicking Deactivate from the sub-menu that appears, and then clicking the Big Red Button that appears to ask if you’re sure.

I was going to have to do this more than a thousand times.

So I did what you might expect: I put the work off for weeks. But today, I decided to dig in… and use Stairways Software’s $36 Keyboard Maestro to do the job. Here’s the macro I built, which you can download here:

  1. Click on the button next to the user. I took a screenshot of the button and added it to Keyboard Maestro’s amazing Click at Found Image command. Since the user list contains many users with a button next to each of them, I told Keyboard Maestro to click on the topmost one.
  2. After a brief pause for the interface to update, Keyboard Maestro then clicks on the Deactivate User button in the resulting sub-menu, again via a Click at Found Image command.

  3. After another brief pause, Keyboard Maestro clicks on the Big Red Button, which it has once again matched via Click at Found Image.

  4. After a two-second pause for the entire interface to refresh, Keyboard Maestro simulates a scroll wheel and scrolls down 77 pixels, which is the height of each user in the list of users. Now the deactivated user has scrolled off the top of the screen, and the topmost button will be the next user to be deactivated.

  5. Keyboard Maestro moves the mouse to the top corner of the screen, because there’s a mouseover effect in the scrolling user list that confuses Click at Found Image.

  6. Repeat 1000 times!

After three or four attempts that required refinement, I ran the macro and went out to run an errand. When I returned, my mass user deactivation had worked.

I know I say this all the time, but it bears repeating. If there is a boring, repetitive task you are being forced to do on your Mac, it can be automated. Even if you have to call in Keyboard Maestro to literally click on various parts of the interface for you.

If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.


Search Six Colors