Slashdot Mirror


AppleScript - the Definitive Guide

honestpuck writes "It is refreshing to find a book that is totally honest about the drawbacks of the language it hopes to teach. AppleScript: the Definitive Guide is one such volume. Matt Neuburg delves into all the flaws inherent in this language." Read on for the rest of honestpuck's review. AppleScript - the Definitive Guide author Matt Neuburg pages 476 publisher O'Reilly and Associates rating 8 - Well written, good topic coverage, some flaws reviewer Tony Williams ISBN 0596005571 summary Excellent guide

AppleScript as a language and development environment has some terrible problems, and I applaud Neuburg for not trying to hide them away. Personally I love the power the language can provide, while loathing it for it's "English-like" syntax and the problems inherent in having most of the language defined in differing ways in different applications.

One of Applescript's problems is that it is difficult to teach, as you almost have to understand everything before you can know anything. Unfortunately that problem is reflected in this book. Neuburg constantly finds himself having to resort to the "believe me for now, I'll explain later" strategy throughout the book.

The book is broken up into four sections: "AppleScript Overview," "The AppleScript Language," "AppleScript In Action," and several appendices.

"AppleScript Overview" is a well written look at what AppleScript is, what it is good for and how to use it. Chapter 3, "The AppleScript Experience" is an impressive warts-and-all walk-through of the author developing an AppleScript to solve the problem of renaming files to conform to a particular standard using FrameMaker and the Finder. It is here that the reader will first see the problems inherent with AppleScript as Neuburg battles with incomprehensible dictionaries, unknown object models and uncommunicative error messages to build his script.

Part II, "The Applescript Language," is the 200-page core of this book. Neuburg provides a detailed and comprehensive look at every detail of AppleScript's syntax and semantics. The first chapter of this section, "Introducing AppleScript" contains a marvelous section entitled 'The "English-likeness" Monster' that is a short, sharp (and entirely justified) attack on the problem of AppleScript's attempt to be English-like in syntax.

In the rest of this section Neuburg provides an exceptional survey of the language. I personally appreciated his examination of the intricacies of type coercion and the exotic scoping rules. He has also taken the time to write and elaborate a large number of small pieces of code to demonstrate gotchas and tricks throughout the language.

It is this section that truly separates this book from every other AppleScript book I have previously read -- it is a masterful guide to the language.

Part III is a concrete path towards writing your own scripts. Neuburg starts by examining application dictionaries in depth. The real power of AppleScript lies not in the language itself but in the ability to use language extensions built in to other applications. This also becomes a huge flaw when the only documentation you get is in the application dictionary. As Neuburg puts it "One purpose of the dictionary is to show the human user how to speak AppleScript to a scriptable application in order to drive that application. But a dictionary, by its very nature, is not completely adequate to this task." He then goes on to explain the flaws.

The first appendix is a dump of the AppleScript Suite from AppleScript's 'aeut' resource. This is the core of the language usable everywhere. The second Appendix is a good, useful guide to tools and resources for the AppleScript programmer.

Taken as whole, this is a great book for the AppleScript programmer, both beginner and expert. It has a good writing style, has been well edited and well constructed. Neuburg may be putting in too many forward references, though. Other reviewers, particularly those newer to AppleScript, have called the book frustrating and confusing. I think this may be due to both the high information density in this book and Neuburg's fast introduction to topics that are better explained later in the book. If you are a newcomer to programming and AppleScript then this may be daunting.

If you are new, however, this is still an excellent volume but you may have to force yourself to finish it and then go over at least Part I and II again to truly understand the language. It would probably be a good idea to start trying to build your own scripts after the first read through. I must say, that after taking a good hard look at the way the book has been constructed and ordered I couldn't really come up with a better way that wouldn't have doubled the size of the book.

Visit the O'Reilly web page for the book if you would like to see the Table of Contents or grab an example chapter.

Neuburg has said "My approach is not to rely on documentation, ... but to bang away at the language itself, testing and experimenting, trying to deduce the underlying rules" and this approach has certainly borne fruit in this volume. For all it's minor flaws you cannot say, as may be true of many other tech books, that it is a rewrite of the documentation. He has approached the problem from a different direction and given us a book that offers an excellent guide to the language.

I would recommend it to all Macintosh owners as the perfect way to unleash another powerful aspect of your system. For people who have no AppleScript or programming experience who want to be totally spoon fed this book is probably only a 5, for people with a little AppleScript experience, a fair amount of programming experience and a willingness to stick through to the end this book is probably a 9. It is certainly the best book on AppleScript I have seen.

You can purchase AppleScript - the Definitive Guide from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

6 of 140 comments (clear)

  1. Sorry about the delay by Anonymous Coward · · Score: -1, Offtopic

    michael - see below for the long overdue reply to your post:

    what happened was that I wanted to rewatch the tape for the Simsons and the X-File Finale -and get to see the NYPD Blues episode on that tape as well, which I coudl not see still for that one- before replying to you. KNowing last week that Kiddo was coming over the past week end, I figured I coudl rewatch the Simpsons and X-Files with him. We rewatched the Simpsons, but he never made it to see the X-Files. I then this week wanted to rewatch that one and see the NYPD blues episode, but had to sleep Monday and Tuesday, as I had not the Thursday and Saturday nights at all, preparing for Kiddo;s arrival and then his departure (cooking all night Saturday to Sunday). Yesterday, I *had* to go t the beach or risk never seing one sunny day at all this year...No kidding, I am not exagerating, we had 3 nice days so far, but the other 2 were a long time ago, and at 30C plus incredible humidex, not a day to spend outdoors, at 44C with humidex:(. It was a once a year occasion...I then thought of watching X-Files again last night, and I did, after replying to asl posts as I got back home from the beach. As you maybe know, I post and read posts from FreeNet where they only keep a certain amount of posts on screen, where even trying to keep up to date with those, I miss some through the lot, and hate it when the posts that address me for indstace scroll up and out of sight...As had happened with this one here. Not ebign able to use an editor on FNet, I also wanted to reply to your post form my yahoo account, to be able to edit if needed...But that is a lot of work: at least you sent a copy to me in email, where that simplified a lot, where I yet now have to answer on yahoo, then get to FNet, cancel my mailforward, get back to yahoo, mail to myself in FNet, once I get it in FNet, turn the foward back on, then get to my ebox, save in my work directory, get on asl, upload the text, where uploading will make it all uneven and can require hours of redoing the line breaks, etc, without an editor, i.e.all I can use is the backspace key... I often get disconnected then, and have to start all over...Frustrating it can be, and it requires I am then in a day where I have concentration to not muff it all by pressing a wrong key when I am almost done, too:).

  2. Howard Dean Says, "I Poop Pants!" by Anonymous Coward · · Score: -1, Offtopic
    Heck, laugh if you want. Maybe I'm too much of a kid. Maybe I'm young at heart. Maybe I'm just a little superstitious.

    But every now and then, right around dusk, I'll look out my back window as the sun falls slowly to sleep. And I'll chuckle a little when I catch myself. I just can't stop believing that Negroes exist!

    I never doubted the existence of Negroes as a kid. My parents smiled knowingly and said nothing. But at night, lying in bed, I could imagine that Negroes really might be chirping and fluttering across the nearby countryside, scouring the foliage for the secret ingredients of Negro Stew.And of course I believed the legend that a young child, pure of heart, could make a Negro appear. If I was a good boy, perhaps I might see one tip his top hat and give me a wink!

    It was Mark Twain's classic novel on Negro life, Yassuh, Massuh Clements, Whatevuh Yuh Say, Suh, that hatched an ill plan of mine to actually see a Negro in person. In that immortal piece of Americana, Twain recounts the old legend that a young lad can summon a Negro. He must stand outside at dusk, face southeast, hold a tooth that has just fallen out, and sing:

    Cah Loo, Cah Lee, Tra Loo, Tra Ley,
    A Negro song today!
    Come hear my call, come one and all,
    Tra Lee La Negro, hey!

    If ye be keen to come along
    And sing the magic Negro songs,
    Then Tra Lee La, Tra True La Ley,
    T'will be a Negro day!

    If all goes well, the young boy will hear a voice singing in the distance:

    A taste of stew, and Negro Pie,
    Oh who will break my fast with me?
    For me it is a weary life,
    But I will sup with thee.

    For tales, I'll tell you of a lass,
    My Negress love at distant shore.
    We'll sing beneath an apple tree,
    A merry Negroling and thee,
    Until the dawn is born.

    And, after suddenly appearing with a flash of light and burst of smoke, the Negro will exchange the tooth for a bag of silver dimes.
    Well, when I was seven, I was ready to try it out. Sneaking out of my bedroom, I crept down the stairs and into the backyard. I was certain that I would actually see a Negro! What would he be like? Would he be mean or friendly? Would he show me the magic sword used to fend off the Irish?

    After singing into the night as loudly as I dared, I stood with an expectant grin. The grass was soft under my pyjama feet. There seemed to be a sparkle in the air! But after several hours of waiting, I slumped with disappointment. No Negroes for me. My father rushed downstairs upon hearing me come in. At first he was worried, but his concerned frown turned into a gentle smile when he heard what I had been up to.
    "Son," he said, somberly. "There are no such things as Negroes."

    A little bit of my childhood died that day. But not completely. Whenever the dusk falls on a clear summer day, I look out to the southeast and dream of a bite of Negro Pie.

  3. I'm a Republican! (A poem) by Anonymous Coward · · Score: -1, Offtopic

    Oh, I'm a Republican
    I got a small schling
    I like to bomb niggahs
    and make a lot o' bling

    I got a bunch o' friends
    in high up places
    They helps me get dem
    government graces.

    You think I'm smart
    I just know who's who
    I couldn't run a fruit stand
    without the red white & blue

    I fancy myself
    A brilliant tactician
    But neither me nor m'buddies
    Could even pass basic trainin'

    See, I'm above all that
    A fightin' and shootin'
    I just say "Sic em!"
    Then run the other direction

    Don't need no history
    Don't need no schoolin'
    I got my ideology
    To keep me a shootin'

    Liberals! Faggots!
    Commies and queers!
    Socialist hippies
    Full o' pussy tears!

    I'll drop some crap
    about Jesus the Christ
    You'll buy it all
    and vote for me twice

    'Fact, Jesus is comin'!
    Real soon, now!
    So we gotta prop up Israel
    That ol' sacred cow

    Propaganda's m'friend
    But I calls it "fact"
    Even though I don't read
    'Cept for Chick tracts

    Facts? No! Don't need em here!
    We're conservatives! We work on FEAR!
    Don't like what we say?
    Well FUCK YOU, bud!
    We'll shove it down yer throat
    and tell ya it's good!

    ---
    Forward it to yer buddies.

  4. HEY EVERYBODY! by Anonymous Coward · · Score: -1, Offtopic

    GOATSE loves me!

  5. I have Excellent Karma by ellem · · Score: -1, Offtopic

    I would like to sell my Karma for 24.95USD so I can purchase this book from Bookpool.com.

    Who will buy my Karma?

    I would like to have this book on my desk by next Wednesday.

    --
    This .sig is fake but accurate.
  6. Pfft. Applescript? Who needs applescript. by numbski · · Score: -1, Offtopic

    Real men use Bourne. And they like it!

    cat "shutdown -p now" >> /etc/rc

    Sit back and watch the fun. :)

    --

    Karma: Chameleon (mostly due to the fact that you come and go).