Although it may not be apparent at first glance, OS X 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.
Mavericks added tags to the Finder. A tag is a text label you create yourself—a word or phrase that tells you something about what’s in a file. For example, you might use the word recipe
as a tag and apply it to any document that contains a recipe. That would enable you to quickly locate recipes later, even if none of them contain the actual word “recipe” in their title or contents.
Any file can have more than one tag. So you might apply the tags recipe
, dessert
, French
, and vegetarian
to your recipe for crème brûlée. Other files would have different combinations of tags, and as you search by tags, only those that match the combination you specify would show up.
You can use tags instead of, or in addition to, hierarchical filing in nested folders. You might have tax-related documents scattered in dozens of folders on your disk, but if they’re all tagged with tax info
, you can instantly see them all in one place. (The Finder also allows you to associate a color with your text labels to make them easier to identify quickly.)
If you apply tags to files you create or download, that makes it quicker and easier for you to find them later—either manually or as part of a smart folder (see Create and Use Smart Containers). Ergo: a shortcut!
Every app that comes with OS X, including the Finder, has keyboard shortcuts for common commands.
The best-known type of keyboard shortcut performs a menu command. You can see the shortcuts right on the menus (Figure 3).
The symbols represent modifier keys:
So, if you see a command labeled ^⌘T (File > Add to Sidebar in the Finder), that means hold down both the Control key and the Command key and press T.
The easiest way to learn what keyboard shortcuts are available for menu commands is to take a look at the menus as you use them. Although every app has its own set of shortcuts, most apps are consistent in their use of a number of common shortcuts, such as:
Every Mac user should know these common shortcuts cold, because they’re useful in nearly every app.
For many more common shortcuts, see Apple’s OS X keyboard shortcuts page.
In addition, you should know a couple of general principles about menu commands. These are not hard-and-fast rules, but they’re overall trends worth being aware of:
Besides shortcuts for menu commands, OS X has many built-in shortcuts for working with text. Here are a few you should know:
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.
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:
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.
The new 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 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 often useful—yet overlooked.
As you work with text in supported apps, OS X can automatically change certain attributes in order to make your text more readable and useful. 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:
" '
) into curly quotation marks and apostrophes (“” ‘’).--
) into an em dash (—).http
or https
) into clickable links.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.
You’ll notice that for smart quotes, smart dashes, smart links, and text replacement, I mentioned earlier in the list that substitutions occur as you type. In other words, if you open a document that already contains straight quotation marks, double hyphens, or plain-text links, OS X 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.
The Transformation submenu contains three commands that change the case of the selected text:
Macs have had built-in speech recognition for a long time. Although this was cool when it first appeared in the mid-1990s, I’m sorry to say that Apple has paid little attention to this feature over the years, and it doesn’t work especially well. Perhaps a future version of OS X will include Siri’s much more advanced capabilities, but for now, it’s possible to get at least basic voice control with Speakable Items. And for the purpose of this book, the interesting point is that you can create your own voice commands to open documents and apps, run scripts, press keys, and do other custom activities—that is, your voice can trigger shortcuts, just like a menu command or keyboard shortcut.
To use Speakable Items:
If you’re lucky, what you expect will happen! (And, if you’re done playing with this feature and you want to get rid of that floating window, go back to System Preferences > Accessibility > Speakable Items > Settings and select the Off radio button.)
OS X comes with many speakable commands for built-in applications, and some third-party applications add their own commands. To see what it’s possible to say, press and hold Esc to activate Speakable Items and say, “Show me what to say.” A floating window appears with a list of all possible commands. Although that list is quite long—and Speakable Items does understand some small variants in phrasing—it doesn’t come close to the plain-English comprehension capabilities of Siri.
However, you can add your own items to this list! Apple provides simple instructions to do so on the page OS X Mountain Lion: Create spoken commands (which also applies to Mavericks). You might use this, for example, to speak commands like these:
If you like, you can eliminate the need to press Esc and instead use a trigger word. For example, if you preface each command with “Computer…” that can alert Speakable Items that the next thing you say should be interpreted as a command. To do this, go to System Preferences > Accessibility > Speakable Items > Listening Key. Select Listen Continuously with Keyword, optionally enter a different name (yes, you can call your computer “Cindy” if you want to), and choose an item from the Keyword Is pop-up menu to specify whether the keyword is optional, required before every command, or required only 15 or 30 seconds after the last command.
To learn more about Speakable Items, read the Apple support article OS X Mountain Lion: Create spoken commands (which still applies to Mavericks).
You can also create your own speakable items using Automator; for instructions, see Speakable-Workflows at Mac OS X Automation.
If you’ve used Mavericks (or its predecessor, Mountain Lion) for any period of time, you’ve undoubtedly seen the system-wide Notifications feature, which puts little messages in the upper-right corner of your screen to tell you about things like new email messages, Twitter mentions, and birthdays.
Although they may sometimes seem more like time-wasters than time-savers, notifications can become useful automation tools when you tailor them to your needs, using them to reveal important information that would otherwise require significant digging.
First, the basics. To determine what the system does when an app sends a notification:
Changes take place immediately.
Having set up those system-wide preferences, you need to visit each individual app’s preferences to determine which events or conditions trigger a notification. That’s where the real power comes in.
Every app is different, but let me give you some ideas about uses for notifications that may not be immediately obvious:
display notification [text]
; in Automator, use the Display Notification action.) For example, you might have an AppleScript Folder Action display an alert when someone adds a file to a shared folder. For more details, see the System Notifications Support page at Mac OS X Automation.When you first set up a new Mac, part of the process involves creating an administrator account for yourself as the owner. If you stick with the default settings, OS X logs you in automatically with that account whenever you turn on or restart your Mac.
The alternative is to select or enter your username and then type your account password. And that’s a safer approach, because it means that if your Mac were lost or stolen, or if someone else got access to it, there’d be at least a modest barrier between any other user and your data. However, if you’re confident enough in your Mac’s physical security to enable automatic login and it’s currently disabled, you can turn it back on as follows:
The next time you turn on or restart your Mac, it logs you in automatically and you’ve just saved yourself a bit of time every day.
Why waste time every morning opening up Mail, Safari, and whatever other apps or documents you always use? Instead, set them to open automatically so you’ll be good to go.
You log in—either explicitly (by entering your username and password) or implicitly (using Automatic Login, described just previously)—when you turn on or restart your Mac, or when one user logs out (Apple > Log Out Username) and another logs in. Whenever that happens, OS X can open apps, folders, or documents for you.
To configure any item currently in your Dock to open on Login, click and hold on its Dock icon and choose Options > Open at Login from the contextual menu.
To configure other items to open on login:
The next time you log in, the specified items open automatically. (To remove an item from this list, select it and click the minus button.)
You can shut down your Mac or put it to sleep manually whenever you want by using commands on the Apple menu, but you can also configure your Mac to shut down, sleep, or wake on a schedule. The main reason to bother with this is to save electricity. Even though modern Macs don’t use very much, it does add up over time. Once you’ve got this set up, your Mac will be ready and waiting for you when you arrive to work in the morning.
To configure automatic shutdown, sleep, and wake settings:
Your Mac then sleeps, shuts down, and/or wakes according to your new settings.
In Mavericks, all updates to Apple software (including OS X itself, built-in software such as Safari and QuickTime, and optional purchases such as iPhoto and Pages), are delivered through the Mac App Store app. And, of course, you can update all the third-party apps you’ve purchased from the App Store at the same time.
To check for updates manually, you open the App Store app and click the Updates button on the toolbar. (As a shortcut, choose Apple > Software Update.) 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.
But this is a book about automation, so we’re more interested in how to make this happen automatically! You can have Software Update 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 like to learn about them as soon as possible. And, because I install almost every update, it saves time to let OS X download updates automatically in the background. 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 set up your Mac accordingly.
To configure App Store updates, follow these steps:
From now on, your App Store software updates according to your settings without you doing a thing.
Software that doesn’t come from 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 Web page 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.
When you put together a rule-based search—whether it’s a smart folder in the Finder or a smart playlist in 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 just 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 iTunes, and numerous 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:
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.
I’ll use the Finder to illustrate how to set up a rule-based search; remember, you follow the same steps wherever you use this technique.
To perform a rule-based search in the Finder:
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.
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 10), where you can specify, for example, is [Within Last] [12] [Days]
.
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 as you wish.
Choose Any, All, or None from the pop-up menu, fill in the condition just as in Step 5, and optionally add more conditions as in Step 6. Repeat this step (at any level of the rule) to add still more nested conditions.
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.
The Finder has smart folders. iTunes has smart playlists. Mail has smart mailboxes. iPhoto 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:
~/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.(I recommend live updating, by the way; 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 contextual 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.
If you’re still not sure how a smart container might serve as a useful shortcut, consider these ideas:
tax info
, regardless of the files’ locations. Handy for tax time![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.