Use Built-In Automation Features

Although it may not be apparent at first glance, macOS contains dozens of built-in automation features, just waiting for you to make use of them. In fact, later in this book, I’ll discuss numerous ways to take advantage of built-in features, such as:

But in this chapter, I want to introduce you to a core set of built-in automation capabilities that don’t fit logically within another topic—or that don’t go as far as the more capable third-party tools that I discuss later in this book. Most of these involve things you can do in the Finder or in System Preferences, and they’re among the easiest ways to start automating your Mac.

Use the Mac’s Built-In Keyboard Shortcuts

Every app that comes with macOS, including the Finder, has keyboard shortcuts for common commands.

Text Editing Shortcuts

Besides shortcuts for menu commands, macOS has many built-in shortcuts for working with text. Here are a few you should know:

  • Arrow key: Move the insertion point in the direction of the arrow.

  • Option-← or Option-→: Move the insertion point left or right by a word.

  • ⌘-← or ⌘-→: Move the insertion point to the beginning or end of the current line.

  • Option-↑ or Option-↓: Move the insertion point to the beginning or end of the current paragraph.

  • ⌘-↑ or ⌘-↓: Move the insertion point to the top or bottom of the document.

  • Shift plus any of the above: Select text from here to the destination. For example, Option-Shift-→ selects the next word, while ⌘‑Shift-← selects to the beginning of the line.

Spend an hour or so practicing these shortcuts and you’ll be able to do much of your text editing without reaching for a mouse or other pointing device.

Make Your Own Keyboard Shortcut

If a menu command in one of the apps you use doesn’t already have a keyboard shortcut—or if it does, but you want to change it to something different—follow these steps to create your own:

  1. Go to System Preferences > Keyboard > Shortcuts > App Shortcuts.

  2. Click the plus button.

  3. In the dialog that appears (Figure 2), select the app you want the shortcut to work with from the Application pop-up menu. (If you don’t see it listed there, choose Other, navigate to the application, and click Add.) If you want your shortcut to work in all applications (or in, say, the pop-up PDF menu that appears in the Print dialog of all your apps), choose All Applications from the pop-up menu.

    Figure 2: Specify the app, menu item, and keyboard shortcut.
    Figure 2: Specify the app, menu item, and keyboard shortcut.
  4. Enter the menu command—for example Paste, (not the name of the menu itself—for example, Edit) for which you want to specify a shortcut in the Menu Title field.

    You must get everything—including capitalization, punctuation, and spaces—exactly correct. If what you type here doesn’t precisely match what’s on the menu, it won’t work. One exception: If you see an ellipsis (…) at the end of a command, you can type either the single ellipsis character (Option-;) or three periods. Either way works.

  5. Click in the Keyboard Shortcut field and press the key combination you want to use. (If another command previously used the shortcut you enter, your new shortcut will override it.)

  6. Click Add.

The shortcut should immediately appear next to the menu command in the app—even if the app is still running—and can be used right away.

Sometimes an app has two or more menu commands with the same name, located on different menus or submenus. For example, in Mail, you can find Format > Quote Level > Increase as well as Format > Indentation > Increase. Likewise, the mailbox names on the Message > Move to and Message > Copy to submenus are the same. So if you specify only the menu command name (like Increase), it may not connect to the right command.

To address this problem, instead of entering just the menu command name, enter the full path through all the submenus, with -> (that is, a hyphen followed by a greater-than sign)—and no spaces—between each step, like so: Format->Quote Level->Increase. This ensures that the shortcut goes only with the menu command you specify.

If you’re uncertain what keyboard shortcuts might be useful, here are some ideas to get you started:

  • If you frequently assign tags to files, you may want to assign a keyboard shortcut to the Finder’s File > Tags… command. ⌘-T, ⌘-Shift-T, and ⌘-Option-T are already used by other menu commands, but you can reassign any of them to Tags… if you like.

  • How about an All Applications shortcut to open System Preferences (found with a trailing ellipsis […]—on the Apple  menu)?

  • Lots of apps have Check for Updates… commands (usually on the application menu—the one bearing the application’s name), but that command almost never has a shortcut. If you use it frequently, it might benefit from an All Applications shortcut.

  • Your keyboard may have keys you rarely if ever press (F13–F15, anyone?), and they can be put to good use. Most of these keys have preassigned shortcuts, which you can see by looking through the various categories of System Preferences > Keyboard > Shortcuts, but if you think a key can serve you better by performing a different action, you should feel completely free to change it.

Use and Customize Toolbars

Many Mac apps have a toolbar at the top of each window, and sometimes different windows within the same app display different toolbars. For example, Mail has one toolbar for the main viewer window, another for messages opened in their own window, and a third for the window used to compose new messages or replies.

Each toolbar has buttons and menus for commonly performed tasks, but if you’re anything like me, you tend to ignore most of what appears on a toolbar. After all, I don’t need a button for Save or Reply or Bold as I invariably use keyboard shortcuts for these actions.

While most toolbar controls are simply alternative ways to perform actions using menu commands or keyboard shortcuts, you shouldn’t write them off, because:

  • A shortcut is a shortcut. If you can click a button on a toolbar more quickly than you can locate the equivalent menu command or memorize a keyboard shortcut, this becomes the most efficient way to perform the activity.

  • Even though default toolbars are often pretty dull, you can customize almost any toolbar to make it genuinely useful.

To illustrate the second point, consider Preview. Its default toolbar (as it appears when a PDF is open) is shown in Figure 3.

Figure 3: The default Preview toolbar.
Figure 3: The default Preview toolbar.

That’s OK, I guess. But I’ve customized mine (Figure 4) to add several more controls that I nearly always find useful when viewing PDFs: Scale (which shows me the current zoom percentage and lets me type in a different number to change the zoom), Previous and Next (for navigating), and Page (which lets me type a page number to jump directly to it). Sure, there are other ways to access these features, but in this specific instance, I find the revised toolbar more efficient.

Figure 4: My customized Preview toolbar, with labels.
Figure 4: My customized Preview toolbar, with labels.

In fact, I go a step further and hide the labels (Figure 5), to give myself a bit more vertical space.

Figure 5: My customized toolbar without labels.
Figure 5: My customized toolbar without labels.

To customize a toolbar in any app:

  1. Right-click (or Control-click) the toolbar and choose Customize Toolbar from the contextual menu.

  2. Drag icons onto or off of the toolbar, or rearrange them as you like.

  3. Click Done.

You can also choose Icon and Text, Icon Only, or Text Only from the contextual menu to show or hide icons or labels.

Use macOS Text Substitutions and Transformations

If you look at the Edit menu in TextEdit, Mail, Messages, Safari, and numerous other applications that include text editing features, you’ll see a Substitutions submenu and a Transformations submenu. These two submenus contain shortcuts for manipulating text. You don’t have to do anything to make them appear (and you can’t add the commands in apps that don’t natively support them), but I think everyone should know about them, because they’re useful yet often overlooked.

Substitutions

As you work with text in supported apps, macOS can automatically change certain attributes in order to make your text more readable. When an item on the Edit > Substitutions submenu is checked, it means that substitution is enabled for that app (only) until you deselect it. (Choose a menu command again to toggle it.)

Substitution options are as follows:

  • Smart Copy/Paste: If you double-click a word to select it, and then copy and paste it, a space is added before and/or after if necessary to separate it from the adjacent text. Similarly, if you double-click a word to select it and then press Delete, extra spaces are removed. (Smart copy/paste does not occur if you manually drag to select the word.)

  • Smart Quotes: As you type, this feature converts straight quotation marks and apostrophes (" ') into curly quotation marks and apostrophes (“” ‘’).

  • Smart Dashes: As you type, this feature converts two consecutive hyphens (--) into an em dash (—).

  • Smart Links: As you type, this feature converts URLs (including strings macOS interprets as URLs, even if they don’t start with a scheme such as http or https) into clickable links.

  • Data Detectors: This feature intelligently identifies strings of text that match patterns like street addresses, dates (even vaguely stated dates, like “next Tuesday” or “breakfast tomorrow”), phone numbers, and flight numbers—and then lets you do appropriate things with them like add an entry to Contacts, schedule an event in Calendar, look up a location in Maps, track a flight, and so on.

    With Data Detectors enabled, if you see a chunk of text that looks like one of the kinds of data I just mentioned, move your pointer over it. If Data Detectors considers it to be an appropriate kind of data, a dotted box will appear around it, with a downward pointing triangle on the right. Click the triangle to display either a contextual menu with one or more options, or a popover with additional controls, depending on the type of data.

  • Text Replacement: As you type, this feature replaces abbreviations with user-specified words or phrases, or corrects misspellings. (This feature is important enough that I talk about it separately; see Use Text Replacement in macOS.)

  • Show Substitutions: Select this command to display the Substitutions window (Figure 6), in which you can change any of your settings for the current app (selecting or deselecting the checkboxes has the same effect as selecting the corresponding menu command) or apply substitutions retroactively.

    Figure 6: Adjust preferences for substitutions in this window.
    Figure 6: Adjust preferences for substitutions in this window.

I mentioned earlier in the list that substitutions for smart quotes, smart dashes, smart links, and text replacement occur as you type. In other words, if you open a document that already contains straight quotation marks, double hyphens, or plain-text links, macOS does not convert them automatically. If you want to make such conversions after the fact, open the Substitutions window, select the desired checkboxes, and click Replace All (to affect the entire document) or select a portion of the text and click Replace in Selection.

Transformations

The Transformation submenu contains three commands that change the case of the selected text:

  • Make Upper Case: Converts all lowercase letters to their uppercase equivalents

  • Make Lower Case: Converts all uppercase letters to their lowercase equivalents

  • Capitalize: Converts the first letter of each word in the selected text to uppercase (regardless of whether that would constitute proper “title case”)

Control Your Mac with Your Voice

Macs have had built-in speech recognition for a long time. Although this was cool when it first appeared in the mid-1990s, Apple paid little attention to the feature for many years. Starting with macOS 10.12 Sierra, however, Macs include Siri. Now you can ask your Mac questions and tell it to do things for you without using any special software, just as you can on an iOS device, Apple Watch, or Apple TV.

For times when you need to use your voice to perform specific functions outside Siri’s skill set, you can also Use Dictation Commands. This feature lets you run scripts, press keys, and do other custom activities—that is, your voice can trigger shortcuts, just like a menu command or keyboard shortcut.

In ideal conditions, using speech recognition can make it feel like you’re living in a science-fiction future—things just happen magically at the sound of your voice. However, it works best in relatively quiet environments and in settings where talking to your computer won’t distract or disturb other people. (So, it’s not great for when you’re working on your MacBook Pro at Starbucks, as I am at the moment.) And even when it works, it’s slower for certain tasks than keyboard shortcuts. Still, it’s well worth becoming acquainted with your Mac’s voice-control tools.

Use Siri

Siri, Apple’s voice-controlled digital assistant, needs little introduction at this point. Now that it’s part of macOS, it gives you many of the same informational and control capabilities as its counterparts on other platforms—plus some capabilities unique to the Mac. Scholle McFarland provides detailed coverage of Siri in her book Take Control of Siri. Here, I’ll provide just a quick overview.

Before you can use Siri, you must enable it. You may have turned it on while installing or upgrading macOS by leaving a checkbox selected, which it is by default. But if not—or if you’re unsure—go to System Preferences > Siri and make sure Enable Ask Siri is selected. (This appears as Enable Siri on older versions of macOS.) While you’re there, you can also configure other options, such as which voice, microphone, and keyboard shortcut Siri should use.

Once Siri is enabled, you can activate it so that it listens for and responds to vocal commands, in any of the following ways:

  • Press the Siri keyboard shortcut. (By default, the shortcut is to hold down Command and Space together for about a second. You can change this in System Preferences > Siri, and I suggest that you do, because otherwise it’s too similar to the default shortcut for Spotlight, which is to press ⌘-Space and quickly release both keys.)

  • Click the Siri icon in the menu bar.

  • Click the Siri Dock icon.

  • Say “Hey Siri!” on supported Macs—newer models that include the T2 security chip. (To enable this feature, go to System Preferences > Siri and select Listen for “Hey Siri.”)

  • In Catalina or later, with Voice Control enabled (see the sidebar Voice Control Changes in Catalina, ahead), say, “Open Siri.”

  • In Mojave or earlier, activate Siri with your voice using the “Start Siri” Dictation Command—as long as you’re already in dictation mode (see Use Dictation Commands in Mojave or Earlier) or you say the dictation keyword phrase (see Using Dictation Commands Without the Keyboard).

Siri responds with a couple of beeps and a “What can I help you with?” window (Figure 7). You can then speak your question or command.

Figure 7: Siri is now ready to listen to you.
Figure 7: Siri is now ready to listen to you.

Siri doesn’t require your commands to follow a preset pattern. Within reason, you can phrase your requests in everyday language and Siri (usually) interprets them close to what you would expect.

Although Siri can’t offer shortcuts to everything you might want to do on your Mac, you can start with these suggestions:

  • Launch Safari.

  • Tell my wife I’m on my way.

  • Look up Frank’s address.

  • Show me documents I created last week.

  • Search the web for coffee grinders.

  • Increase screen brightness.

  • Play something by the B-52’s.

  • What’s today’s weather forecast?

Although I rarely use Siri on my Mac, I find it most useful for commands that would otherwise require multiple steps or digging around in System Preferences, like “What’s my Mac’s serial number?” or “Enable Bluetooth” or “Show me PDFs with the label Important.” For more suggestions on how to use Siri on your Mac, see these articles:

Use Dictation Commands

As long as your Mac is running Yosemite or later, you have access to Dictation Commands—speech recognition capabilities that are more primitive than Siri, yet also more flexible in the sense that you can customize them to do very specific things, for example simulating keyboard shortcuts or menu commands.

As I noted above in the sidebar Voice Control Changes in Catalina, Catalina treats these commands a bit differently (and just calls them “Commands,” not “Dictation Commands”). So the instructions that follow differ depending on which version of macOS you’re using.

Use Dictation Commands in Catalina or Later

In Catalina, Dictation Commands are part of Voice Control, rather than part of Dictation. (Catalina no longer calls them Dictation Commands, even.) Thus, you can use them only when Voice Control is enabled. To enable Voice Control, you can either ask Siri to do it (“Enable Voice Control”) or follow these steps:

  1. Go to System Preferences > Accessibility > Voice Control.

  2. Select Enable Voice Control. A floating window (Figure 8, left) appears.

Figure 8: This floating window tells you that Voice Control is enabled—though not necessarily active.
Figure 8: This floating window tells you that Voice Control is enabled—though not necessarily active.

Voice Control is now enabled, but not yet active—to make your Mac begin listening to your commands, click Wake Up or say “Wake up.” (To make it inactive, click Sleep, as in Figure 8, right, or say “Go to sleep.”)

With Voice Control active, you can speak a command, such as “Search Spotlight for text” or “Switch to Finder.” (For a partial list of commands you can speak, say, “Show commands.”)

Assuming everything is working correctly, the text of the command you spoke should appear in a small bubble above the floating window, and macOS should execute that command.

In addition, if the insertion point is in a document or field that supports text input, you can dictate text, and macOS inserts it in near-real-time. (Note, however, that not all apps support this feature well. To see how it is intended to function, try TextEdit.) To make changes to your text, you can use spoken commands such as “Select next word,” “Correct that,” “Delete word,” and many others. To see a list, first select one or more characters and then say “Show commands.”

To learn how to create your own dictation commands, skip ahead to Create Your Own Dictation Commands.

Use Dictation Commands in Mojave or Earlier

To prepare your Mac to use Dictation Commands in Mojave or earlier, follow these steps:

  1. Go to System Preferences > Keyboard > Dictation and click the On radio button next to Dictation. Read the privacy notice if it appears, and click Enable Dictation. (Because of what we do in the next step, the privacy notice is irrelevant.)

  2. Select Use Enhanced Dictation. As stated, this requires a fairly large (over 1 GB) download. A download status indicator appears in the lower-left corner of the window.

  3. When the download is complete, go to System Preferences > Accessibility > Dictation, click the Dictation Commands button, and select Enable Advanced Commands at the bottom. Click Done.

With those preparatory steps out of the way, do the following to use Dictation Commands:

  1. Press the Fn key twice. (If you want to change this keyboard shortcut, go to System Preferences > Keyboard > Dictation and choose a different shortcut from the Shortcut pop-up menu.) You hear a chime and a floating window called the Dictation Response HUD appears (Figure 9).

    Figure 9: This floating window, called the Dictation Response HUD, shows that the macOS Dictation feature is listening.
    Figure 9: This floating window, called the Dictation Response HUD, shows that the macOS Dictation feature is listening.
  2. Speak a command, such as “Search Spotlight” or “Switch to Finder.” (For a complete list of commands you can speak, say, “Show commands.”)

Assuming everything is working correctly, the text of the command you spoke should appear in a small bubble above the Dictation window, and macOS should execute that command.

macOS uses the same user interface for commands (things you tell your Mac to do) and dictation (turning your speech into written text). So, if you’re in a text editor or anywhere else that a text insertion point appears, you can also dictate text while the Dictation window is visible, and macOS inserts it in near-real-time. In addition, you can use spoken commands to edit your text (for example, “Select previous word” and “Italicize that”), though the list of available editing commands is much shorter than in Catalina.

Create Your Own Dictation Commands

macOS includes oodles of base commands (more than 100 in Mojave, and more than 200 in Catalina), many of which can be further extended. For example, you can insert the name of any menu in the “Click menu name menu” command, and the name of any running app in the “Quit app name” command.

You can even add your own commands. Custom commands can open files or apps, paste text or other data, perform keyboard shortcuts, or run Automator workflows (which, in turn, can include AppleScript, JavaScript, and shell script code)—see Get Started with Automator.

To create your own Dictation Commands, follow these steps:

  1. Go to System Preferences > Accessibility > Voice Control (Catalina or later) or System Preferences > Accessibility > Dictation (Mojave or earlier).

  2. Click Commands (Catalina or later) or Dictation Commands (Mojave or earlier).

  3. Click the plus button.

  4. In the “When I say” field, enter the word(s) you want your Mac to respond to.

  5. From the “While using” pop-up menu, choose Any Application if you want your command to work everywhere, or choose a specific app to restrict the command to that app.

  6. From the Perform pop-up menu, choose the action you want to perform in response to the command, such as Open Finder Items, Open URL, Press Keyboard Shortcut, or Run Workflow, and select or enter the requested details.

  7. Repeat the above steps as desired to add more commands.

  8. Click Done.

Now your custom commands should work whenever your Mac is accepting voice input. In Catalina or later, that’s when Voice Control is active; in Mojave or earlier, it accepts voice input when the Dictation Response HUD is visible or you’ve spoken the activation keyword you set up following the tip in the Using Dictation Commands Without the Keyboard sidebar a page or two back.

Update Apple and Mac App Store Software Automatically

All updates to Apple apps that aren’t included as part of macOS (such as Pages and Final Cut Pro), are delivered through the App Store app. And, of course, you can update all the third-party apps you’ve bought from the App Store at the same time.

To check for app updates manually, you open the App Store app and click Updates. Then, to update a single application, click the Update button next to it. (In some cases, Apple groups multiple software updates together; click the More link to see details on each one.) To update all the listed applications at once, click Update All. Enter your Apple ID and password if prompted to do so, and click Sign In. The App Store downloads and installs the updates.

To update core macOS components manually in Mojave or later, you can open System Preferences > Software Update and, if any updates appear, click Update Now (or Upgrade Now). This may require restarting your Mac.

But this is a book about automation, so we’re more interested in how to make this happen automatically! You can have macOS merely inform you of future updates or download (and optionally install) them as soon as they appear.

Because software updates often fix crucial bugs and add important features, I prefer to learn about them (and download them) as soon as possible. I don’t necessarily install updates as soon as they appear, because I might be busy with things that can’t be interrupted—and I want to know when something might be about to change—but some people may choose to do so as the fastest and most hands-off method. Still others never want to be interrupted with alerts about new software and dislike the idea of anything downloading behind their backs, or they need to keep an eye on a bandwidth usage cap. You can decide where you stand and configure your Mac accordingly.

Configure Software Updates in Mojave and Later

If your Mac is running Mojave or later, follow these steps to configure software updates:

  1. Go to System Preferences > Software Update (Figure 10). macOS checks for updates, and any available updates appear at the top of the pane. To apply them, click Update Now.

    Figure 10: Configure automatic updates in this preference pane.
    Figure 10: Configure automatic updates in this preference pane.
  2. To turn on all automatic updates (not the best idea, in my opinion), check “Automatically keep my Mac up to date.” Or, to specify which updates you want macOS to install automatically (a much better idea), click Advanced. A dialog (Figure 11) appears.

    Figure 11: Select which types of automatic updates you want here.
    Figure 11: Select which types of automatic updates you want here.
  3. The “Check for updates” checkbox is selected by default. Deselect it to disable (or re-enable) automatic checking. (In some situations, you must enter your password after changing this checkbox.) If it’s selected, you can also select any or all of:

    • Download new updates when available, which not only notifies you of updates but also downloads them for you so you can install them as soon as you’re ready. (In the notification, click Install to install immediately; click Later and choose Try in an Hour, Try Tonight, or Remind Me Tomorrow from the pop-up menu to “snooze” the reminder; or click the notification itself to open the App Store and see which updates are available.)

    • Install macOS updates, which downloads and installs updates to macOS itself—for example, macOS 10.15.x—and asks you to restart your Mac. (You may be prompted for your password if you change this checkbox.)

    • Install app updates from the App Store, which silently updates installed apps from the App Store, except those requiring a restart or other interaction.

    • Install system data files and security updates, which installs these essential updates without prompting you, but only after they’ve been available in the App Store for 3 days

Although you’re welcome to check whichever of these boxes you like, my personal preference (and recommendation) is to check all of them except “Install macOS updates” (as shown in Figure 11, above). I like having most of my software updated automatically, but for system updates, I prefer to wait until I’ve confirmed that other users aren’t experiencing any major problems with them, and then apply them.

Configure Software Updates in High Sierra and Earlier

To configure App Store updates in High Sierra and earlier, do this:

  1. Go to System Preferences > App Store.

  2. Select or deselect (as you prefer) the Automatically Check for Updates checkbox to enable or disable automatic checking. If it’s selected, you can also select any or all of:

    • Download Newly Available Updates in the Background, which not only notifies you of updates but downloads them for you so you can install them without further waiting

    • Install App Updates, which installs updates to nonessential apps (that is, those that don’t fall into the next category) automatically in the background

    • Install macOS Updates, which does the same as Install App Updates except for macOS itself—for example, macOS 10.15.x—and may prompt you to restart your Mac

    • Install System Data Files and Security Updates, which automatically (without prompting you) installs essential updates—but only after they’ve been available in the Mac App Store for 3 days

  3. If you’re signed in to the App Store, you can also check or uncheck Automatically Download Apps Purchased on Other Macs, which does exactly what it says.

From now on, your App Store software updates according to your settings without you doing a thing.

Update Non-Mac App Store Software Automatically

Software that doesn’t come from Apple or the App Store must use a separate update mechanism. Happily, most modern applications contain some sort of update feature. Unhappily, they don’t all work the same way. Some check for updates every time they’re launched, or on a fixed schedule, while others check only on demand; of those that do check automatically, not all have this feature turned on initially. Some programs can download and install new versions of themselves automatically, while others download a disk image and expect you to open it and run the installer yourself; still others do nothing but open a webpage with links to updates you can download manually.

In an ideal world, updates would require no intervention other than a click or two to confirm that you’re aware of, and approve of, the installation; everything else would happen automagically. Because many applications still lack that level of automation, though, you may have to perform some extra steps.

For now, do the following. Whenever you download and install a new app that doesn’t come from the App Store, check its preferences to see whether there’s an Automatically Check for Updates (or similar) feature. If so, be sure to turn it on! If you can choose how often to check, choose the most frequent option. You might also do the same for your most frequently used apps the next time you open them.

Figure 12: In some applications, such as Transmit (left), the Check for Updates command appears in the application menu—the one with the same name as the application. In others, such as Excel (right), it appears in the Help menu. Wording may also differ between apps.
Figure 12: In some applications, such as Transmit (left), the Check for Updates command appears in the application menu—the one with the same name as the application. In others, such as Excel (right), it appears in the Help menu. Wording may also differ between apps.

Work with Rule-Based Searches

When you put together a rule-based search—whether it’s a smart folder in the Finder or a smart playlist in Music or iTunes—you let your Mac do the tedious work of identifying items (files, messages, songs, and so on) that are of interest to you. This saves you the time and effort of manually looking through many potential matches for the right thing. Define the search once, and even if it’s extremely complex, you can repeat it whenever you want with just one click—a classic automation shortcut.

Advanced searches in the Finder, rules in Mail, smart playlists in Music/iTunes, and many other environments—including some in third-party apps such as Hazel (see Organize Files with Hazel) and DEVONthink—use a nearly identical interface for finding things based on a series of conditions. Once you’ve learned how to construct one of these rule-based searches in one place, you can recycle that knowledge, with minor variations, in lots of different places, many of which I cover in the next topic (Create and Use Smart Containers).

Before we begin, let me clarify some basic concepts:

  • Condition: A condition (sometimes called a criterion) is any piece of information used to identify an item you’re searching for—a word in a filename, a modification date, the sender of an email message, and so on.

  • Multiple conditions: A search can have more than one condition, and these can be used together or individually.

    For example, I can search for all files that both (a) contain the word “book” and (b) were modified within the last week, in which case files that have one of those attributes but not the other wouldn’t show up in such a search. This is known as an All search, because all the conditions must match.

    Or I can search for files that either contain the word “book” or were modified with the last week, which would match a much larger number of files. This is known as an Any search, because matching any one of the conditions is enough for a positive result.

  • Nested conditions: Most rule-based search environments (sadly, not Mail’s rules) have a hidden capability to simulate Boolean (AND/OR/NOT) logic by grouping conditions in Any, All, and None categories. For example, I can search for files that contain Any of Jack or Jill, or All (i.e., both) of Cindy and Sandy, but None of Thomas. In other words, written in Boolean notation it would look like (Jack OR Jill) OR (Cindy AND Sandy) AND NOT Thomas. You can use this technique to devise highly detailed and specific searches.

I’ll use the Finder to illustrate how to set up a rule-based search; just remember, you’ll follow the same steps wherever you use this technique.

To perform a rule-based search in the Finder:

  1. Press ⌘-F (for Find). The insertion point jumps to the Search field in the upper-right corner.

  2. Type some text in that field, such as book. The window begins filling with all the files on your Mac containing that text. Press Return to search for the text you’ve entered in the contents of any file, or select a narrower category (such as “Name matches: book”) from the pop-up menu that appears.

    Your search now has its first condition, such as “must contain the text book,” but you can change that later.

  3. Optionally change the search scope by clicking a folder name, This Mac, All, or another term on the left side of the search bar.

  4. Click the plus button next to the Save button (below the Search field). A new row appears (Figure 13).

    Figure 13: Click the plus button to see a new condition row.
    Figure 13: Click the plus button to see a new condition row.
  5. From the leftmost pop-up menu in this new row, choose an attribute to search for, such as Kind, Name, or Contents.

    Depending on what attribute you choose, the rest of the row may change. For example, if the attribute is Kind, then the only thing left in the row is a single pop-up menu you can use to pick a kind. But if you choose [Created Date], you see additional pop-up menus and/or fields (Figure 14), where you can specify, for example, is [Within Last] [12] [Days].

    Figure 14: As you change attributes, the rest of the row adjusts.
    Figure 14: As you change attributes, the rest of the row adjusts.

    With each choice you make, the rest of the row adjusts accordingly. For example, if you chose [Created Date] followed by is [exactly], then the remainder of the row changes to show only a date field where you can enter a single, specific date.

    Use the pop-up menus and fields to specify your entire condition.

  6. To add a second condition that will narrow the search, click the plus button at the right of the current condition and repeat step 4.

  7. To add a nested condition or group of conditions with its own Any/All/None specification, hold down the Option key and click the ellipsis button, which replaces the plus button. A new section (Figure 15) appears. Choose Any, All, or None from the pop-up menu, fill in the condition just as in step 8, and optionally add more conditions as in step 9. Repeat this step (at any level of the rule) to add still more nested conditions.

    Figure 15: When you hold down Option and click the ellipsis button, your search options expand considerably.
    Figure 15: When you hold down Option and click the ellipsis button, your search options expand considerably.
  8. Recall from step 5 that in Finder searches, whatever you initially typed into the Search field remains part of the search. If you want to remove it (to search only for the detailed conditions you added later), select the text in the Search box and press Delete.

That may seem like a lot of steps, but most of them are optional—and once you’ve done a few searches this way, the process will seem both quick and obvious. With this technique under your belt, you can now move on to create smart containers.

Create and Use Smart Containers

The Finder has smart folders. Music (like iTunes before it) has smart playlists. Mail has smart mailboxes. Photos has smart albums. Contacts has smart groups. I refer to all these (and similar constructions in other apps) collectively as smart containers. Although they may look like folders or mailboxes or whatever, they’re really just saved searches. You construct search rules as described previously, click a button to save the search, and give it a name. Then…hey, presto! Select that smart container whenever you want to display an up-to-date list of all the items that currently match your search.

Here’s a quick overview of how to create and use smart containers in several popular apps:

  • Smart folders (Finder): Choose File > New Smart Folder (⌘-Option-N), or create a search rule as described in the previous topic. When you’re finished, click the Save button in the search bar. Give the smart folder a name, choose a location (the default is ~/Library/Saved Searches), and for maximum convenience, also check Add to Sidebar. Click Save. Thereafter, select that item in a Finder window’s sidebar (or open it wherever you saved it) to show currently matching items.

  • Smart playlists (Music/iTunes): In Music (or iTunes), choose File > New > Smart Playlist (⌘-Option-N). Fill in the desired conditions, and optionally select the checkboxes to limit the playlist to a certain number of tracks, match only checked items, or use live updating.

    (I recommend live updating; without it, the smart playlist will always show whatever it happens to match at the time you created it, unless you manually update it by right-clicking or Control-clicking the smart playlist and choosing Update Smart Playlist from the menu. However, live updating may make iTunes slower to respond; if so, you’ll have to decide which annoyance you’d rather endure.)

    To view and play the items in that playlist, select Playlists (if the sidebar isn’t already visible) and then select the smart playlist.

  • Smart mailboxes (Mail): In Mail, choose Mailbox > New Smart Mailbox. Fill in the conditions you want to use, bearing in mind that Mail does not support nested Any/All/None conditions. Optionally select Include Messages from Trash or Include Messages from Sent, as you prefer. Give the smart mailbox a name and click OK. Smart mailboxes appear in their own category in Mail’s sidebar—if it’s not visible, choose View > Show Mailbox List.

  • Smart groups (Contacts): In Contacts, choose File > New Smart Group (⌘-Option-N). Fill in the conditions that you want to use, name the smart group, and click OK. Smart groups appear with your other groups (if any) in the sidebar. To view all the contacts in a smart group, select it.

If you’re still not sure how a smart container might serve as a useful shortcut, consider these ideas:

  • A smart folder that shows all the files created or modified in the preceding calendar year that also have the tag tax info, regardless of the files’ locations. Handy for tax time!

  • A smart mailbox that shows you all the messages you sent or received in the last month that mention a certain family member, regardless of where those messages are filed.

  • A smart playlist in Music or iTunes that includes all purchased music tracks that you haven’t yet listened to at least five times. Make sure you get to know all your newly purchased music!

  • A smart group in Contacts that contains all the other parents of kids in the same class as your child. You can do this by having a smart group [Note] [Contains] [school] and then putting the word “school” in the Note field of each parent’s contact. As the class composition changes, you can add or remove “school” from records, and the smart group updates automatically.

Deal with the Mac’s Evolving Security Features

With each new version of macOS, Apple adds or enhances security features. Some of these security changes aim to prevent malware from hijacking your Mac, stealing your data, or displaying annoying ads. Others are intended to thwart hackers who might try to gain access to your computer using a network or via apps that might send private information about you back to the developer without your consent. I think most of us would agree that improved security and privacy are excellent goals.

Unfortunately, Apple’s go-to solution for any perceived security or privacy threat is to display an alert with limited details, letting you decide whether or not you trust the app to perform a given activity. That can result in a long series of alerts. Apple provides too little information to judge the safety of what it’s asked us to approve. So most of us simply end up agreeing to all of them so we can get back to work. (In some cases, we must do more then just click a button, but it’s unclear how the extra steps to enable certain kinds of apps to do their thing makes our lives better.)

The more recent your version of macOS, the more of these alerts you’re likely to see, and it’s particularly bad in Catalina as you launch apps for the first time in that version of macOS. And, for better or worse, the types of automation activities covered in this book are especially likely to prompt these alerts, because they’re also the sorts of things that malicious software might want to do behind your back.

So, before leaving this chapter about the Mac’s built-in automation features, I wanted to be sure to tell you about security features that can interfere with automation—whether you’re using Apple’s software or third-party apps.

Accessibility Access

Apps that manipulate the user interface in one way or another to provide system enhancements and extra features may need you to approve them to use Apple’s accessibility features. Examples include launchers, macro utilities, text-expansion utilities, scripting tools, and AppleScripts that use GUI scripting—among many others. Even apps that come with macOS itself (such as Script Editor) may fall into this category, depending on how you use them.

When one of these apps needs your permission to run, you’ll see an alert like the one in Figure 16.

Figure 16: To grant an app permission to control parts of your Mac’s user interface, click Open System Preferences. To refuse, click Deny.
Figure 16: To grant an app permission to control parts of your Mac’s user interface, click Open System Preferences. To refuse, click Deny.

You can’t grant this type of access right in the alert dialog. Instead, you must open System Preferences (manually or by clicking the Open System Preferences button), go to Security & Privacy > Privacy, and select Accessibility in the list on the left (Figure 17). Click the lock icon at the bottom, enter your password, and click Unlock. Then select the checkbox(es) for the apps to which you want to grant access.

Figure 17: Select the checkbox for any app to which you want to grant accessibility access.
Figure 17: Select the checkbox for any app to which you want to grant accessibility access.

Automation Access

Another category, introduced in Mojave, is automation access. To ask your permission, an app displays a dialog like the one in Figure 18.

Figure 18: This app is asking you for automation access.
Figure 18: This app is asking you for automation access.

You may notice that this dialog specifies the name of an app (in this case, Finder). Any app or utility that requests automation access must do so individually for each app it wants to control. So you may see this alert multiple times per app. To grant automation access immediately, just click OK in the alert. Alternatively—or if you change your mind about an app later—go to System Preferences > Security & Privacy > Privacy > Automation (Figure 19) and check or uncheck the app(s) you permit the listed utilities to control.

Figure 19: For each app that has requested automation access, select the checkbox(es) for the apps you allow it to control.
Figure 19: For each app that has requested automation access, select the checkbox(es) for the apps you allow it to control.

Full Disk Access

Another privacy category introduced in Mojave is Full Disk Access. This isn’t merely about manipulating the user interface or automating actions within an app; this type of access gives the requesting app permission to read and modify files of a potentially sensitive nature (such as your email and messages). That may sound scary, but all it does is place an extra barrier between the bad guys (especially malware) and your important data. It’s entirely appropriate—indeed, necessary—for you to grant certain types of software access to this data. One example is a Mail plugin, such as SpamSieve, which needs access to your email in order to do its job.

If an app or utility needs access to your files, it will generally notify you in some way. There’s no single system-wide alert for this purpose, but an app may display a dialog such as the one in Figure 20.

Figure 20: This app is requesting full disk access, which will enable it to access the files it needs.
Figure 20: This app is requesting full disk access, which will enable it to access the files it needs.

Like Accessibility Access, Full Disk Access requires you to manually pop into System Preferences. If an app needs this control, go to System Preferences > Security & Privacy > Privacy > Full Disk Access (Figure 21). If the app already appears in the list on the right, check the box next to it. If not, click the plus button, navigate to the app, select it, and click Open.

Figure 21: The Full Disk Access category on the Privacy tab enables apps to access data anywhere on your disk.
Figure 21: The Full Disk Access category on the Privacy tab enables apps to access data anywhere on your disk.

Some apps that need Full Disk Access do not notify you. Because of this, they can be completely nonfunctional until you figure out that you need to follow the above steps—and, more confusingly, figure out where to select the precise app file that requires access.

One such app is Terminal. Although Terminal itself, and most command-line operations, work in Mojave and later more or less as they always have, some operations that use the sudo command (such as changing file ownership with chmod) work only if you’ve added Terminal to the list of apps in Full Disk Access. (See this discussion for more details.) Oh, and if you’re using Terminal to change ownership on a remote Mac via SSH, you’ll need to choose Go > Go to Folder in the Finder, enter /usr/sbin, and then drag the SSH daemon (/usr/sbin/sshd) to the Full Disk Access list too.

Files and Folders

In Catalina and later, there are even more situations in which apps have to ask permission to access files, beyond those covered by Full Disk Access. Basically, if an app wants to access a file it didn’t create—without any manual action on your part such as double-clicking or navigating in an Open or Save dialog—it’s going to throw up a dialog, no matter where the file is (even if it’s in the Trash).

You can manage apps to which you’ve granted file access permission in System Preferences > Security & Privacy > Privacy > Files and Folders.

Keystroke Receiving

If an app running in Catalina or later needs to watch for keys being pressed—as is the case for utilities like Keyboard Maestro, which lets you assign keyboard shortcuts to arbitrary actions—you must explicitly allow that access. Go to System Preferences > Security & Privacy > Input Monitoring. Click the lock icon and enter your password. Then select the checkbox next to each app you authorize to watch your keyboard.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset