You’ve seen many of the amazing and powerful things that LaunchBar can do with applications, files, and folders, as well as with your calendar, contacts, iTunes library, and more. But LaunchBar has yet another trick up its sleeve. You can use LaunchBar to trigger actions and services, and integrate LaunchBar into workflows you create with Apple’s Automator.
In this chapter, I’ll show you how LaunchBar can stretch its reach beyond your files and applications to control your Mac and interface with Mac OS X and with other applications.
In this chapter, I cover three types of items: actions, services, and workflows. To start, it’s important to explain what these three items are, and how they differ:
Some LaunchBar actions are designed to activate certain features of Mac OS X and its included applications. For example, the Empty Trash action clears your Trash and the Get Mail action tells Mail to check for new email. You can use LaunchBar actions to Log out of your user account, Quit all applications, or restart your Mac.
Other actions help you to save time by “instant-sending” a file or text to another app (see Instant Send, earlier). For example, you can select a photo in the Finder, invoke the bar and keep your keyboard shortcut pressed until the bar appears with the orange arrow at the right, and then choose the Add to iPhoto action to add that image to your iPhoto library. Or, select a URL in any text, instant-send it to LaunchBar, and choose the Add to Safari Reading List action to save it for future reading.
Don’t worry about memorizing all these actions—or assigning abbreviations to them, because you can browse among all available actions in the Actions category (invoke the bar, type ACT, select Actions, then arrow right to browse or sub-search). Notice that some of the actions, such as those relating to Mail, Safari, Twitter, and Facebook, show icons that help you identify them.
Another way to discover LaunchBar actions is to look at the Actions list in the Index window (Figure 40). Some are labeled with the name of a specific application; others are clearly for acting on files, such as actions that compress a file, apply labels, or copy a file’s name. Other actions work on the system level, such as those for restarting, logging out, and changing volume.
Feel free to de-select any actions that you don’t use. This is especially helpful if you trigger actions by browsing the Actions indexing rule since only the actions that you’ve kept selected will appear.
As I mentioned in the beginning of this chapter, Services are a feature of Mac OS X that let one application borrow features from another. A service is provided by either an individual app or Mac OS X itself. There are different types of services. Some act on selected items, such as text, graphics, or files. Others let you interact with applications.
You can access services at any time by opening an application menu (the one with the name of the current application—like Preview, Pages, or GarageBand), then choosing Services. The Services submenu displays the services available in the current context. In other words, a service that acts on text won’t be available if you’re in a graphics program, or if you’re creating music in GarageBand.
You can see all available services in System Preferences. Look in the Keyboard pane, in the Keyboard Shortcuts view, and select Services at the left.
You can view the Services list by invoking the bar, typing SERV, then pressing the Space bar or the right-arrow key. As you can see in Figure 41, LaunchBar shows services followed by the name of the application they come from.
You can also access a service directly by typing an abbreviation. For example, you might type LUD to bring up Look Up in Dictionary.
To use a service, just select it and press Return.
Many services display text fields when you activate them; this is the case for Look Up in Dictionary, Make New Sticky Note, and Open man Page in Terminal, among others. For these, you’ll need to enter something before pressing Return.
If a service acts on text—for example, the Start Speaking Text service—select text in an application, send the text to LaunchBar, and then select the service in the bar. Or, if a service acts on some other item, like a file in the Finder or a graphical image in a word processor, first select that item, then send it to the bar and select the service.
As with actions, discussed above, you may want to cull the Services list. To do this, invoke the bar, press Command-Option-I to display the Index window, and click on Services. Deselect any services you don’t plan to use.
LaunchBar provides special actions that Apple’s Automator can use. Automator is a tool that lets you create workflows, services, and applications that act on items much like AppleScript can, but without the need to write code. Instead, you create an Automator workflow, service, or application by dragging items from a list of actions in order to combine them, a bit like Lego bricks.
Automator and LaunchBar can be integrated in a variety of ways, since Automator can create services that LaunchBar can invoke, and because LaunchBar installs some Automator-specific actions inside Automator so workflows can control LaunchBar (Figure 42, ahead slightly).
Automator is a complex tool, and it’s well beyond the scope of this book to explain how to use it. I will, however, give you a taste of how LaunchBar can integrate with Automator by presenting one example of what you can do with LaunchBar’s actions. Let’s create a service that will copy the URL of the current Web page in Safari, then send it to LaunchBar, whose built-in Make TinyURL action will then send it to the TinyURL service to make a short URL for that page:
Automator launches and displays a dialog.
LaunchBar
in the search field above the list of actions to find LaunchBar’s actions.Make TinyURL
. Make sure to type the action name accurately, or the service won’t function correctly.Your workflow should look like the one shown in Figure 42.
The service is saved in LaunchBar’s Workflows indexing rule. You can access it from LaunchBar as you would any application.
To try your new service, open Safari, and visit your favorite Web page. Invoke the bar and type an abbreviation, such as URLSAF; then press Return. The service will copy the URL from Safari, send it to the TinyURL Web site, then return the resulting short URL in LaunchBar. You can then copy the URL from the bar with Command-C, or use send-to to send it by email or iMessage to a friend or colleague.