AppleScript: The Missing Manual and over 2 million other books are available for Amazon Kindle . Learn more

Sign in to turn on 1-Click ordering.
More Buying Choices
Have one to sell? Sell yours here
Sorry, this item is not available in
Image not available for
Image not available

Start reading AppleScript: The Missing Manual on your Kindle in under a minute.

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

AppleScript: The Missing Manual (Missing Manuals) [Paperback]

Adam Goldstein
2.3 out of 5 stars  See all reviews (3 customer reviews)
Price: 19.50 & FREE Delivery in the UK. Details
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
Only 1 left in stock (more on the way).
Dispatched from and sold by Amazon. Gift-wrap available.
Want it Wednesday, 16 July? Choose Express delivery at checkout. Details


Amazon Price New from Used from
Kindle Edition 14.94  
Paperback 19.50  

Book Description

10 Feb 2005 0596008503 978-0596008505 1

From newspapers to NASA, Mac users around the world use AppleScript to automate their daily computing routines. Famed for its similarity to English and its ease of integration with other programs, AppleScript is the perfect programming language for time-squeezed Mac fans. As beginners quickly realize, however, AppleScript has one major shortcoming: it comes without a manual.No more. You don't need a degree in computer science, a fancy system administrator title, or even a pocket protector and pair of nerdy glasses to learn the Mac's most popular scripting language; you just need the proper guide at your side. AppleScript: The Missing Manual is that guide.Brilliantly compiled by author Adam Goldstein, AppleScript: The Missing Manual is brimming with useful examples. You'll learn how to clean up your Desktop with a single click, for example, and how to automatically optimize pictures for a website. Along the way, you ll learn the overall grammar of AppleScript, so you can write your own customized scripts when you feel the need.Naturally, AppleScript: The Missing Manual isn't merely for the uninitiated scripter. While its hands-on approach certainly keeps novices from feeling intimidated, this comprehensive guide is also suited for system administrators, web and graphics professionals, musicians, scientists, mathematicians, engineers, and others who need to learn the ins and outs of AppleScript for their daily work.Thanks to AppleScript: The Missing Manual, the path from consumer to seasoned script has never been clearer. Now you, too, can automate your Macintosh in no time.

Product details

  • Paperback: 352 pages
  • Publisher: O'Reilly Media; 1 edition (10 Feb 2005)
  • Language: English
  • ISBN-10: 0596008503
  • ISBN-13: 978-0596008505
  • Product Dimensions: 2.2 x 17.1 x 22.9 cm
  • Average Customer Review: 2.3 out of 5 stars  See all reviews (3 customer reviews)
  • Amazon Bestsellers Rank: 566,429 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Discover books, learn about writers, and more.

Product Description

About the Author

Adam Goldstein got his programming start in Kindergarten, when he first played around with Logo on an old Apple II. Through middle school, Adam wrote useless but amusing HyperCard programs. Nowadays, he runs GoldfishSoft, a shareware company that makes games and utilities for Mac OS X. Adam was a technical editor for O'Reilly's best-selling Mac OS X: The Missing Manual, and an editor for Mac OS X Panther Power User. When he's not writing books or code, Adam attends MIT.

Excerpt. © Reprinted by permission. All rights reserved.

Chapter 5 - Controlling Files

Most people have a love-hate relationship with their computer. Sure, your Mac is a great tool for when you want to edit images or video, send and receive email, or play Halo. But your computer also serves as a digital file cabinet: a place where you can create and store files, move them around, organize them in folders, trash them when they’re no longer needed, and copy them to another disk or computer on the fly.

Files, of course, are nothing more than individual packages of information that you keep on your hard drive. But for all the filing tasks they perform, most computer users tend to handle files manually: drag this file here, create a new folder there, and so on. After a while, these mundane tasks are what make people start to hate their computers.

If you’re sick of dealing with your files one at a time—and taking up half your day in the process—there’s no better tool in your arsenal than AppleScript. By commanding the Finder, AppleScript lets you:

• Move all the files off your desktop in one fell swoop (page 90)
• Back up an important folder to a separate hard drive, just in case your computer dies (page 93)
• Rename all the files in a folder—without having to type their new names individually (page 113)

For these jobs and more, AppleScript can save you annoyance, tedium, and—most of all—time.

Note: The example scripts from this chapter can be found on the AppleScript Examples CD (see page 24 for instructions).

File Path Boot Camp
The one thing AppleScript can’t save you from is the fact that files are essentially geeky things. Mac OS X’s Unix heritage, while great news for programmers, also means that old Mac fans have to adapt to a few new file conventions—how to name files, what programs to open them with, and so on. Therefore, before you jump headfirst into controlling files with AppleScript, there are a few things you should know:

• In Mac OS X, files should always have a file extension. A file extension is a short abbreviation added after a period in a file name. Microsoft Word files, for example, end in .doc, while sound files often end in .mp3 or .aiff.

To Mac OS X (and Windows, for that matter) a file extension reveals what kind of information a file holds. In many cases, a file extension also tells Mac OS X which program should open a file: .doc files open in Microsoft Word, while .psd files open in Photoshop. (Of course, certain types of files can open in several different programs; .jpg files, for example, can open in just about any image-viewing program on the planet.)

Note: As a general rule, folders should not have file extensions. The exceptions are bundles—little folders that masquerade as files (page 34), like the .key files that Keynote produces.

To see what’s inside in a bundle, Control-click the bundle in the Finder and select Show Package Contents from the shortcut menu. In the new window that appears, you can sift through the files that comprise the package, discovering, for example, that Keynote "files" are actually made up of dozens of smaller files.

Although certain programs don’t require file extensions, it’s still a good idea to use them. That way, if you ever need to send a file to a Windows user, you won’t get back an angry email asking you to resend the file with an extension so your recipient can actually open it.

• A path is a string that tells you how to get to a certain file or folder. Each item in path is separated by a forward-slash (/) in Mac OS X—a by-product of your computer’s Unix heritage. That means the path to your Home - Desktop folder would be /Users/yourUsername/Desktop/, while the path to your copy of Text-Edit would be /Applications/

When you want to play with a path in AppleScript, you can use special type of information called a POSIX file. (POSIX is nerd lingo for "portable operating system interface," which basically means that file paths can be used anywhere, on any computer that supports the POSIX standard. To learn more about POSIX, you can read up on it online at software/en/file_paths.html.) To get the path to your Desktop folder, for instance, you’d write the following, replacing yourUsername with your actual one-word username:

POSIX file "/Users/yourUsername/Desktop/"

Still, you’ll find that most commands (like choose file, for presenting an Open dialog box [page 97]) use the alias type to refer to files. The alias format separates each folder in a path with a colon, rather than a forward slash. To get the alias to your Desktop folder, for example, you’d write this:

alias ":Users:yourUsername:Desktop:"

Note: Of course, you should replace yourUsername with your actual username. If you don’t know what your username is, you can look it up in System Preferences - Accounts; you’ll find your username in the Short Name field.

• You can open any file or folder with the open command directed at the Finder. For example, to open Library - Desktop Pictures - Aqua Blue.jpg (the image that appears behind Mac OS X’s login dialog box), you could write:

tell application "Finder"
activate --Bring the Finder forward
open POSIX file "/Library/Desktop Pictures/Aqua Blue.jpg"
end tell

Note: You’ll notice a couple of oddities when you run this AppleScript. First off, the open POSIX file statement gets changed to open file. Then, all the forward slashes are converted to colons, and AppleScript inserts the name of your hard drive at the beginning of the path string. None of these changes affect what your code actually does; AppleScript just makes these changes so it understands what you’re asking it to do.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

2.3 out of 5 stars
2.3 out of 5 stars
Most Helpful Customer Reviews
1 of 1 people found the following review helpful
1.0 out of 5 stars There are better books than this - plenty! 12 July 2010
Format:Paperback|Verified Purchase
What a disappointment and, in my view, a sad reflection on an otherwise excellent series - The missing Manuals. The content is wooly and confusing. In an attempt to be 'dummy' friendly it makes a relatively simple subject a messy muddle.

There are plenty of better books on this subject. Highly recommended is: Applescript The Comprehensive Guide to Scripting and Automation on Mac OS X by Hanaan Rosenthal
Comment | 
Was this review helpful to you?
4.0 out of 5 stars Informative and Useful 28 Nov 2010
Started to learn applescript about two years ago. Found myself coming back to this book time after time. Full of useful scripts that can be placed in other scripts. They are all well explained and simplified for both absolute beginners and those who have acquired more knowledge. My copy is now so worn out through me going back to it for information. Something rare, despite owning a large number of help manuals. If you are interested in automating the mac environment, go for it. It will save you precious time. One slight problem, I would like to have seen more information on scripting Iwork, but then this information is quite rare, even on the applescript website.
Comment | 
Was this review helpful to you?
0 of 1 people found the following review helpful
2.0 out of 5 stars OK if you just want a quick overview 6 Dec 2010
Format:Kindle Edition
Not much good if you want an in depth treatment.

I tried to write a script and quickly ran beyond the coverage of this book - and my script was only 20 lines.

A bit jokey-blokey in its style - which is OK for a while and then it grates.
Comment | 
Was this review helpful to you?
Most Helpful Customer Reviews on (beta) 3.6 out of 5 stars  22 reviews
37 of 40 people found the following review helpful
4.0 out of 5 stars Another Missing Manual Hit 9 Feb 2005
By Mary Norbury-Glaser - Published on
[...]AppleScript: The Missing Manual by Adam Goldstein is part of the Missing Manual series of beginner/intermediate books published by Pogue Press/O'Reilly and Associates. The focus of this book series is on computer products that have been released without adequate printed manuals (Mac OS X, iLife '04, Google, iPod and iTunes, Windows XP, Windows 2K among others). Their newest release, AppleScript: The Missing Manual, is a welcome addition to their catalog of smart, funny and user-friendly books.
AppleScript is a scripting language that mimics the syntax of English. As such, it's extremely similar to how sentences are structured and, as a result, is very intuitive and simple to use. However, this doesn't belie the fact that it's a very powerful tool for automation.
Goldstein's Missing Manual is an exciting newcomer to the meager collection of AppleScript introductory volumes. This book covers the current Mac OS 10.3 (Panther) release of AppleScript and includes multimedia support, GUI scripting and AppleScript Studio. While it is intended for the beginner and intermediate user, power-hounds will also find many tricks, tips and hidden tools within its pages.
The book is divided into four parts: "AppleScript Overview", "Everyday Scripting Tasks", "Power-User Features" and "Appendixes".
Part One begins with the usual suspects: where to find the AppleScript folder in Mac OS X, how to enable the script menu and the surprising number of useful scripts you'll find there. In just a few pages, Goldstein hands the reader a collection of valuable scripts that were hiding in OS X Panther all along (I particularly like the "ransom note" script).
Part Two is the main core of the book and covers "Everyday Scripting Tasks". The seven chapters in this section run the gamut of increasing difficulty: manipulating text, controlling files, creating lists, organizing and editing graphics, playing sound and video, internet and network scripting and organizing information in databases. The author quickly takes the reader through a series of simple scripts designed to illustrate AppleScript syntax.
Once the reader whips through the example scripts in Parts One and Two, it's time to get down and geeky. Part Three titled "Power-User Features", is the section of the book for geeks and wanna-be geeks. Goldstein shoves enough advanced techniques in five chapters to make these alone worth the price of the book. The reader learns how to enable folder actions, attach built-in folder actions to specific folders, view and edit these built-in folder actions and run his or her own actions.
My favorite chapter in this section is Chapter 13, Mixing AppleScript and Unix. Goldstein gives a quick terminal lesson followed by a neat trick to display the Expose button ("the blob"). Other helpful actions: use do shell script to run Unix programs straight from AppleScript, run shell scripts with admin privileges, run AppleScripts from Unix thus saving time by bypassing the Script Editor and schedule commands (use an AppleScript to run cron every day, use iCal to schedule scripts). Even users who normally shy away from the terminal will want to try some of these.
Part Four contains the Appendix A through C: "AppleScript Support in Common Programs" (a very useful set of tables of applications, their level of AppleScript support, price and where to get them), "Moving from Hypercard to AppleScript" (options and advice for converting Hypercard stacks to AppleScript and major syntax differences between HyperTalk and AppleScript) and "Where to Go from Here" (AppleScript sources: Web sites, discussion lists and books).
Goldstein's style of writing is exceptionally clear with just a dash of humor that humanizes the experience of reading a technical or "how-to" manual. The reader won't find anything confusing, lacking in detail or dull. This book is eminently satisfying on many levels: the writing style is conversational and humorous (I would imagine this is a pre-requisite for writing for David Pogue), the style of this book series is consistently pleasant to read and the level of technical difficulty satisfies the range of readers from beginner through power-user. The "valuable information:price" ration is, hands-down, in the buyer's favor.
A final note about Adam Goldstein, the author of Applescript: The Missing Manual...he is the teenage founder of GoldfishSoft ([...] a Mac OS X games and utilities software company (my 7 year-old son loves AlgeKalk and FrakKalk, geek that he is). By "teenage", I mean Adam Golstein is 17-ish. He began contributing to this Pogue/O'Reilly series several years ago by writing a few sections of Mac OS X Panther Edition: The Missing Manual (FileVault, journaling and Disk Restore). I suspect we'll be hearing a lot more from Mr. Goldstein...and I'm looking forward to it.
25 of 27 people found the following review helpful
2.0 out of 5 stars More like a travel guide 21 Oct 2005
By MacDesigner - Published on
This is not a "manual" in any sense of the word. A manual tells you how, where, and when. This is more like a tour guide of Applescript. Sure there are scripts, but few of them make the Mac easier to use than its own OSX interface. The information is presented in such a scattered form, that it is hard to follow for very long, and therefore hard to learn. It's like trying to learn to be a chef by watching the Cooking Channel.
42 of 49 people found the following review helpful
1.0 out of 5 stars Not for you if you are a programmer.... 4 Aug 2005
By Alan G. Smith - Published on
Format:Paperback|Verified Purchase
Ok, I confess it. I am a programmer. My desire was pretty simple. I wanted a book that would show me all of the parts of Applescript and how to use them.

This is NOT that book. You can see the sample scripts but very little explains how to take that information to make scripts of your own.

This book has lots of sample scripts, but since I am not interested in scripting those applications, it isn't helpful to me.

Perhpas I just wanted too much, but I sent this book back.
15 of 16 people found the following review helpful
2.0 out of 5 stars A bit off the mark... 19 Sep 2005
By J. Rudolph - Published on
As a long time hobbyist, im not really impressed. This book doesn't really touch on too many of the 'hard' issues one would face when first getting started with applescript. The languages syntax, for example, is not as intuitive as its description suggests. Its english like, but its not english, and english takes a decade or so to master.

The book says little about the language, and a disproportionately large part of it is just a series of example scripts categorized by the programs being scripted.

This book is more like the answers to the test than the course that would prepare you for the test. I learned close to nothing from it.

Im sure it has its place, but as someone pretty familiar with programming, I find that practical examples _aswell as_ some deeper, language directed discussion is nessesary to get anything other than a weak grasp on any language. Especially a language as slippery as applescript. But I guess I got what I paid for... its a pretty cheap book.
14 of 15 people found the following review helpful
4.0 out of 5 stars A Good Book For Beginning Programmers 20 Oct 2005
By Michael J. Waddell - Published on
Pros: Humorous, Easy To Read, Numerous Good Examples

Cons: Teaches primarily by example, Little rigorous treatment of the language itself

Recommended for: People with no programming experience who want to automate their Mac and beginning programmers who want to learn the basic principles of programming in an easy-to-learn language

The author, a high school student, gives us a good introductory book about AppleScript. It stays true to the "Missing Manual" philosophy in that if the average Mac user found it in the box with their new Mac, they wouldn't be turned off by it.

However, given the lackluster reception that Automator received with the release of Tiger, it seems to me that the potential audience of people with limited programming experience who want to automate their mac is quite limited. Therefore, I think that the ideal audience for this book is beginning programmers who want to learn the fundamental, and universal, concepts of programming using an easy-to-understand language that is already available on their computer.

Chapter 1 shows how to enable the Script Menu and walks us through each script therein. Chapter 2 shows how to launch and use the Script Editor to open, modify and save scripts. These 2 chapters provide an introduction to what is already installed on each new Mac.

Chapter 3 is the first chapter that begins to introduce the language itself. This chapter introduces dialog boxes and the "tell" statement for controlling other applications. This chapter also introduces the concept of "dictionaries." Dictionaries are the essence of AppleScript in that they outline every command and variable of each program that is AppleScriptable. Much of the book is essentially an overview of key selected items out of the dictionaries of common programs such as the Finder and TextEdit. In fact, a large portion of the most commonly used commands in AppleScript are found in the Finder and Standard Additions dictionaries.

Chapters 4, 5 and 6 introduce key programming concepts such as looping, subroutines, string manipulation and lists. These concepts are introduced as needed to complete particular example scripts. Each of these programming concepts in introduced in a very easy-to-understand method with some concepts, like inheritance, explained using analogies even your mother could understand.

Chapters 7 through 10 focus primarily on scripting specific programs based upon the commands found in each program's dictionary (e.g., iTunes, Safari, iPhoto). However, some interesting concepts specific to AppleScript are discussed as needed. For instance, these chapters introduce the "say" command to invoke Text-to-Speech and the "record" datatype which works much like a hashtable does in PERL.

Chapter 11 introduces folder actions and how to link scripts to them. Chapter 12 discusses the System Events dictionary and how it can be used to script programs that would not otherwise be AppleScriptable. Chapter 13 introduces some basic UNIX commands and how they can be executed from within an AppleScript.

Chapter 14 discusses debugging and introduces AppleScripts's version of try-catch statements. This is a very important chapter for beggining programmers, especially since these concepts are well presented and directly applicable to programming in any language.

Finally, chapter 15 introduces the use of XCode and Interface Builder to create more sophistocated AppleScripts. This chapter is not only a good introduction to building complex AppleScript applications, but it is an easy-to-follow introduction to the concepts in XCode and Interface Builder that are common to all types of projects -- be they in AppleScript, C++ or Objective-C.

My major complaint with this book is that it does not have a list of all of the language's keywords with the syntax for the use of each (similar to what you might see in a "Nutshell" book). Without this, the book is not as effective of a reference tool as simply going to the dictionaries directly. Also, I feel that the book glosses over the fact that although AppleScript is a very "English-like" language, it does require precise syntax.

Overall, it is a good introduction to programming and true to the "missing manual" series. However, a slightly more rigorous examination of the language syntax would take it from "good" to "great."
Were these reviews helpful?   Let us know
Search Customer Reviews
Only search this product's reviews

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
First post:
Prompts for sign-in

Search Customer Discussions
Search all Amazon discussions

Look for similar items by category