Doing the same thing over and over on your Mac? Four ways to automate it
Typing the same sentence again, renaming files one at a time, clicking the same buttons dozens of times. Your Mac already has features that take this kind of repetition off your hands. Each fits a different kind of work, so here they are from the simplest up.
1. Phrases you type often: text replacement
If you keep typing the same thing, such as your email address, payment details or a standard greeting, text replacement is the easiest fix.
- Go to System Settings → Keyboard and click Text Replacements under Text Input.
- Click +, type a short abbreviation on the left and the full phrase on the right.
- Now type the abbreviation and press Space, and it turns into the phrase.
Pick abbreviations you would never type otherwise. Starting them with a semicolon, like ;mail, keeps them from firing by accident. It works in apps that use the standard macOS text fields, such as Notes, Mail and Safari, but some apps don't support it.
2. Many file names: rename them at once in Finder
No need to rename dozens of photos or documents one by one. Select them all in Finder, right-click, and choose Rename…. You can rename them in one of three ways:
- Replace text in the names (for example,
IMG_toTrip_) - Add text before or after the names (for example,
_finalat the end) - Give them a new name with a number (
Meeting 1,Meeting 2…)
An example of the new name is shown at the bottom, so check it before you click. If you don't like the result, press ⌘ Z to undo.
3. Several steps in one go: the Shortcuts app
The Shortcuts app in your Applications folder chains several actions together so one click runs them all. You build a shortcut by dragging actions from the list on the right, so you don't need to write code.
- Shrink the selected photos, convert them to JPG and save them
- Open the apps and web pages you use to start the day, all at once
- Reformat the text on the clipboard and add it to a note
In a shortcut's details you can give it a keyboard shortcut or pin it to the menu bar. The catch is that Shortcuts can only control an app that offers actions for it. Buttons inside apps without actions, or clicks inside a web page, are hard to do with Shortcuts.
4. The exact clicks and typing: record and play back
For work Shortcuts can't do, such as pressing the same buttons in the same order in one program or copying values from one window into another, you can record the keyboard and mouse input you make and play it back exactly. This is often called a macro.
LoopIt is a free app for this. Press F8 and do the work once to record it, then press F9 to play it back at the same speed. You can set a repeat count (0 means until you stop it), a pause between runs and an overall time limit, and touching the keyboard or mouse stops it right away. Apps like this read and send input, so macOS requires Accessibility permission.
Rules for record-and-play
- Leave windows where they were. Mouse clicks are recorded as places on the screen. If a window moves or changes size, clicks land in the wrong place.
- Record slow spots with room to spare. Playback keeps the timing you recorded. If a page loads late, things can drift, so wait for loading to finish while recording, and give a generous pause between runs.
- Run it 2 or 3 times first. Raise the count once you've seen it work.
- Know how to stop it. LoopIt stops when you press F9 (fn+F9 on a MacBook) or touch the keyboard or mouse.
- Don't automate what you can't undo. Leave out work that includes delete, send or pay buttons.
- Don't use it where automated input is banned. Online games and services whose terms forbid automation may suspend your account.
Which one to use
| What you want to do | Use |
|---|---|
| Type the same phrase often | Text replacement |
| Rename many files at once | Finder rename |
| Combine actions from several apps | Shortcuts |
| Repeat the exact same clicks and typing | A record-and-play app such as LoopIt |
Try them from the top down. The more a method is built into the Mac, the less it depends on window positions and timing, so the more reliable it is.