HACKER Q&A
📣 Austin_Conlon

What are some macOS automation tips and tricks?


What are some macOS automation tips and tricks?


  👤 arthtyagi Accepted Answer ✓
I used a few ways to automate certain tasks in the previous versions of MacOS.

- Automator. The Automator allows you to create routines so you can do things like automating the change in theme after a specific time or something close to that. Essentially, it helps in creating routines and automating other tasks as well.

- Apple Script. You can write pure AppleScript to automate tasks.

You can definitely always use languages like Python for writing scripts that are generally meant for MacOS and automate tasks.

Resources to get started : https://automatetheboringstuff.com/chapter0/ https://developer.apple.com/library/archive/documentation/La... https://www.macworld.co.uk/how-to/mac-software/what-automato...(


👤 sircastor
Open up Automator. I remain surprised at the capabilities Automator offers out of the box.

As an example, for work I have bitmap images that come from an embedded system. They get pulled into a folder where a folder action crops them to particular dimensions and converts them into PNGs. The cropping is actually done with a shell script via imagemagick. You can mix and match scripts with Automator actions.


👤 csilverman
Automator and AppleScript are the top two automation tools on macOS. Automator is the more user-friendly of the two; provides a visual workflow interface for chaining together tasks and capabilities. AppleScript is Apple's attempt at natural-language scripting. Between the two, there's very little you can't automate on Mac, although both have counter-intuitive idiosyncrasies that can be frustrating.

One of the best non-Apple—and, seemingly, least well-known—Mac automation tools is called Hazel: https://www.noodlesoft.com/. I've been using it for years, and I strongly recomend it.

Hazel does one specific thing, but it does it really well: it watches a specific folder for files that match criteria you specify, and it does something to them: moves them, copies them, renames them, even passes them to a script (AppleScript or Javascript) or Automator workflow. Here's a few things I'm doing with Hazel:

- keeps my desktop clean by moving all files that are more than a day old into a "desktop_archive" folder, which is organized into month and year folders: /2019/09, 2019/10, etc.

- automatically unpacks downloaded zip files, and moves any fonts I download into a Fonts folder

- checks the desktop for any text files that begin with "notes" (or "project ideas", "journal", and a couple of other things) and moves them to their respective folders, also organized chronologically.

- checks the desktop for any image files with specific filenames, and runs an Automator workflow on them that resizes them, renames them, converts them to JPG, and uploads them to a remote server. (This is for a project I'm doing where I upload sketches to my blog; all I need to do is save a screenshot to my desktop, and Hazel takes care of the rest.)

Depends on your needs, but Hazel is one of the best apps I've found for automated file management. The setup I have right now is that I can save certain regularly created types of files to my desktop and Hazel does the rest. Saves me a lot of mucking about saving and formatting stuff. (Disclaimer: I don't work at Hazel, know anyone who does, or have any incentive to say nice stuff about them—it's just one of these really useful apps.)

Also, FYI, Hazel is pay-once: no scummy subware pricing or anything like that.