Chapter 11

Automating Tasks and Customizing Lion

Just about every computer user knows that using a computer means doing a lot of the same things over and over. Whether you need to attach an image to an e-mail, insert pictures into your iPhoto library, or download digital content from the Internet, you’re going to be performing a lot of repetitive tasks. Regardless of the type of computer system you have, repetition is typically just part of using a computer; however, that does not have to be the case when you use a Mac.

images

Lion comes with an extensive toolset for automating those repetitive tasks that you have to contend with everyday. The Lion operating system was designed with the user in mind; and as a result, it has powerful tools that allow you to fine-tune and control what, when, where, and how things happen. In this book’s final chapter, we will look at a few applications and preferences that use automation to dramatically influence the way you interact with Lion, greatly reducing the repetition inherent in accomplishing tasks on your computer. We will pay particular attention to Lion’s built-in automation tool, Automator. Learning to use automation effectively will enable you to tap more deeply into the awesome power of the Lion operating system.

Automation can be a tremendous time saver, but what makes Lion especially powerful is that you can automate just about anything you do on Lion. Automation on the Mac is limited only by your enthusiasm and creativity.

NOTE: Lion ships with Automator and other great tools for automating tasks; however, I strongly recommend that you use fake data as you learn to take advantage of these tools. This will help you avoid making a mistake that accidently deletes or irrevocably damages an important file. Until you can use these tools flawlessly, you should keep your automation workflows and applications away from your real data. The last thing you want is to lose an important business contact or that photo of your daughter taking her first step.

Understanding Automation

Automation is the core principle behind all computing. Computing in general is meant to save us time by allowing the computer to respond to and address our needs with as little manual input from us as possible. As I prepare this final chapter, several of Lion’s built-in automation features are helping me do so. Most of this help occurs in the background, out of sight; however, a handful of these automation features are visible to me as I type.

For example, I am currently connected to the Internet. This enables me to look up information instantly and to be notified when I have new e-mail. For as long as I’m connected to the Internet, my Mac’s internal firewall is protecting me from various Internet threats. At the same time, various applications are using that Internet connection to determine whether updates are available. And, right in front of me, I can see my word processor’s spelling and grammar checker working away—correcting my misspellings, repositioning my punctuation, and alerting me to grammatical anomalies such as incomplete sentences. As all this goes on, my clock is dutifully tracking the time. And, without any input from me, my word processor is talking to that clock, saving my document every five minutes. At the same time, my music player is randomly selecting tracks from my iTunes library and playing them. That is a lot of automation taking place, and this list is far from comprehensive. Managing all this automation is exactly what operating systems are intended to do.

We’ll begin our survey of Lion’s built-in applications and tools for automating tasks with one of its most important: Automator.

The Basics of Automator

Most operating systems require you to purchase expensive software before you can start doing any real programming. Others offer free tools that are cumbersome and difficult to learn, which creates a steep barrier to entry for those interested in learning how to make program their computer. Fortunately, this isn’t true of Lion, which comes with one of the most powerful automation tools ever created—a tool that can be used by even the most novice Mac user.

Automator empowers Mac users by decreasing their reliance on expensive programming solutions that require either an expert or college courses to use. Apple created Automator using many of the founding principles of the Mac operating system; that is, it made Automator easy to use, accessible, powerful, and secure. Automator can be picked up and used by anyone who can read and use a mouse and keyboard. When using Automator, implementing basic automation is very easy and requires almost no training whatsoever.

To use this app, locate the Automator icon in your Applications folder and open it (see Figure 11–1).

images

Figure 11–1. The Automator icon

Once Automator opens, it will present you with several workflow templates for automating your computer (see Figure 11–2).

images

Figure 11–2. Automator’s workflow template selector

Each of these programming workflow templates is intended to help you accomplish a specific type of automation. Table 11–1 lists the automation templates available and explains how you can put them to use.

NOTE: Clicking each template item will give you a description of each template’s intended purpose.

images

images

All of these workflows have their place and can save you a great deal of time when used appropriately. In this chapter, we will focus on workflow basics, walking you through how to use the Workflow template for a pair of examples. The first example combines some simple and advanced tasks for automating dictionary terms, while the second leverages intermediate-level tasks to download an image from the Internet.

Example 1: Automating Text Audio

In our first workflow example, we’ll create a process that asks the user to type in a dictionary term, so that Lion’s Dictionary application can read that term back to the user. Begin by opening Automator and choosing the Workflow template (see Figure 11–3).

This will cause Automator to bring up a Library dialog that displays a submenu consisting of pre-built Automator actions organized by category. Our sample application is considered advanced because it uses all five of Automator’s available automation layers. These five layers consist of the following actions:

  • prompting the user
  • receiving user input
  • processing the user input
  • providing a response to a request
  • using and/or processing multimedia files
images

Figure 11–3. Selecting the Workflow template in Automator

Implementing the workflow is as simple as following these steps:

  1. Select the Utilities option from the Library menu.
  2. Type “wait” in the Search bar to bring up the Wait for User Action window.
  3. Drag the action to Automator’s Builder window. The result should look exactly like Figure 11–4.
    images

    Figure 11–4. Prompting the User

  4. Replace the message text shown with “Please enter a dictionary term that you would like read to you.” Leave everything else the same.
  5. Clear out the search context by pressing the x icon in the Search dialog (or simply delete the word “wait”).
  6. Go to the Library submenu, select the Text option, and drag the Ask for Text action until it’s under the Wait for User Action dialog (see Figure 11–5).
    images

    Figure 11–5. Accepting user input

  7. So far you’ve told the user what you need and accepted his input. Now it’s time to process that input. Select the Get Definition of Word action from the same submenu, and place it beneath the Ask for Text dialog (see Figure 11–6).
    images

    Figure 11–6. Sending input to the Dictionary

  8. The user’s input is now being processed by Lion’s built-in Dictionary app; however, you have yet to implement the steps necessary to make this app talk. From the same submenu, select the Speak Text action and drag it under the Get Definition of Word dialog (see Figure 11–7).
    images

    Figure 11–7. Speaking the output

  9. You now have all of the required components in place, so it’s time to run the program. Do so by pressing Automator’s Run button (see Figure 11–8).
  10. Once the program is running, enter the word “summer” when asked to input a dictionary term. You will hear the Dictionary speak this word back to you.
images

Figure 11–8. Running the workflow

Voila! In less than ten minutes, you have created a workflow program that can be used to teach users how certain words are pronounced. It would be easy to extend this functionality to provide even more real-world value. For example, you might combine this functionality with other workflow actions to create a program that teaches visually challenged children definitions from the Dictionary app. Or, you might use Automator to alter many different aspects of the Dictionary’s basic features, including the voice type, prompt, or dictionary type. The sky is the limit, even with a program as small as this one. Let’s try one more example.

Example 2: Automating Internet Downloads

In this example, you’ll learn how to automate downloading image files over the Internet. This workflow will prompt the user for input, ask her to give provide an image URL address for an image she would like to download, and then proceed to download the image file to the folder she specifies. This type of automation is extremely useful, and it can save you a lot of time once you learn how to use it. It is also applicable to other files you might want to download because you can use this same technique to download any other type of Internet media or even multiple files. For now, let’s keep things simple, so can you get a basic understanding of what is going on. Follow these steps to automate downloading that image file:

  1. Select Utilities from the Library menu and type “wait” into the Search bar to bring up the Wait for User Action window.
  2. Drag the action into Automator’s Builder window (see Figure 11–9).
    images

    Figure 11–9. Prompting the User

  3. Replace the message text with “Please enter image URL you would like to download.” Do not make any other changes and remember to clear out the Search box of all text.
  4. Select Text from the Library submenu, drag it over the Ask for Text action, and then place it under the Wait for User Action dialog you dropped into Automator’s Builder window (see Figure 11–10).
    images

    Figure 11–10. Accepting User Input

  5. Go to the Internet submenu and select the Download URLs action (see Figure 11–11).
    images

    Figure 11–11. Automator’s Download URLs action

  6. Now it’s time to download the image by running the workflow (see Figure 11–12). When prompted, change the download destination to your desktop and use the following URL as your input:
    http://www.linuxwallpapers.org/apple/free-wallpaper-apple.png
  7. Depending on the quality of your Internet connection, this could take a few minutes or a few seconds. Either way, once the process completes you should see the image shown in Figure 11–13.
images

Figure 11–12. Running the Internet download workflow

images

Figure 11–13. Downloading the image from Exercise 2

These two examples should give you a good idea of the power and flexibility inherent in automating tasks. What makes Automator especially powerful is that you can use it to launch other applications such as iCal for alarms. Moreover, you can execute the workflows that launch these applications as frequently as you need to.

Again, there is no limit to what you can do with Automator. In fact, there are many Mac programmers who make a living turning Automator routines into fully functional applications that can be purchased at the Mac App Store. Cultivating and building your Automator skills could pay off in more ways than one.

Customizing Lion

There are literally more than a million ways to customize your Lion operating system, and this book would be as thick as 100 encyclopedias if I decided to describe each one of them. Of course, you don’t personally need quite so many customizations; you just need the right customizations for you. In the remainder of this book, I will cover some essential customization secrets that can make a world of difference in getting the most out of how Lion presents resources to you. Specifically, I’ll help you understand how to maximize your use of folder organization, indexing, and the screen saver.

Folder Organization

One thing you might notice as you begin to use Lion is that its folders are initially somewhat disorganized. They seem to just sit there, without structure or order. You can change this by right-clicking in the empty space of any of the Finder’s windows and selecting Show view Options from the context menu that appears (see Figure 11–14).

images

Figure 11–14. Lion’s folder view options

After selecting this option, make your view options mimic those shown in Figure 11–15.

images

Figure 11–15. Choosing your view options

After you make these changes, you will notice that your folders and files now line up nicely and evenly in alphabetical order. This is a much better way to organize them.

Indexing with Spotlight

Another crucial customization you might want to do involves Spotlight, an OSX desktop search feature that indexes everything on your computer. One set of information you do not want Spotlight to index is your fonts, as this will slow down your Mac considerably.

To ensure that Spotlight is not indexing your fonts, go to your Mac preferences, open the Spotlight options, and remove the check from the box next to Fonts (see Figure 11–16).

images

Figure 11–16. Deselecting Fonts in Spotlight

Making this change can speed up your Mac considerably because it decreases how much work the Finder must do when you conduct broad inquiries with Spotlight.

Customizing the Screen Saver

Finally, I recommend you make an important change to how your screen saver works. Screen savers can be beautiful and fun to watch, but they also eat up your Mac’s precious memory when they run. Using either the blank or Computer Name screen saver will consume less battery life on your portable Mac. Just as importantly, choosing one of these options will consume less RAM (random access memory) on any desktop or portable Mac you might use (see Figure 11–17).

images

Figure 11–17. Changing your screen saver options

Summary

In this chapter, you learned just how versatile your Lion operating system is. For example, you learned you can fine-tune just about anything in it; but more importantly, you learned that you can make it do just about anything you want it to with a little time and practice.

You also learned that automating things can be fun and educational, as well as save you time and—in some cases—money. The Mac OSX Lion operating system is a true beast, one that is limited only by the imagination, talent, and curiosity of its user.

This book just touches the tip of the iceberg when it comes to what Lion can do, and it should be considered an in-depth teaser to get you started. My hope is that it motivates you to explore your OS in much greater depth, so that you can exploit the true potential of your Lion operating system.

Lion was created to roam the digital Safari (pun intended). Feed it with good intentions, the will to learn, and the power of curiosity—and you never know what you might discover.

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

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