Slashdot Mirror


Beginning AppleScript

norburym writes "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. This series focuses 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). I would venture that this also applies to most major software releases, which should keep Mr. Pogue, O'Reilly and their contributing authors busy for quite some time. Their newest release, AppleScript: The Missing Manual, is a welcome addition to their catalog of smart, funny and user-friendly books." Read on for the rest of Norbury-Glaser's review. AppleScript: The Missing Manual author Adam Goldstein pages 304 publisher Pogue Press/O'Reilly & Associates rating 8 reviewer Mary Norbury-Glaser ISBN 0596008503 summary AppleScript for the Beginning/Intermediate User

AppleScript mimics the syntax of English. As such, its grammar by intent should be easy for English speakers to grasp, which results in an intuitive and simple to use scripting language. However, this doesn't undermine its role as a very powerful tool for automation.

There are very few books on AppleScript, and certainly not many current volumes outside of Matt Neuburg's excellent AppleScript: The Definitive Guide (O'Reilly) for the intermediate-to-advanced scripter, and Hanaan Rosenthal's reference-type manual, Applescript: A Comprehensive Guide to Scripting and Automation on Mac OS X (Friends of Ed). But Neuburg's book is intended for the intermediate to advanced reader while Rosenthal's book is a bit extensive to be called a primer. Hence, there are few worthy contributions for the beginner. Goldstein's Missing Manual fills this gap with coverage of the current Mac OS 10.3 (Panther) release of AppleScript, including multimedia support, GUI scripting and AppleScript Studio. While the book is intended for the beginner and intermediate user, power-hounds will also find many tricks, tips and hidden tools.

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, and how to enable the script menu (and how to take advantage of 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). Chapter 2 introduces the Script Editor application and provides a comprehensive description of Script Editor properties, tools and preferences. After setting up the work environment and introducing the AppleScript tools to the reader, Goldstein begins hands-on scripting in Chapter 3: displaying dialog boxes, commands, commanding other programs, using tell statements and how to find and use the command dictionaries specific to the Finder and other scriptable applications. This author avoids the pitfall of overwhelming the reader with too much information, too many new concepts, and too many abstruse examples.

Part Two is the 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. Chapter 4 covers variables, strings, dialog boxes, scripting applications and running scripts from text. Goldstein scripts TextEdit, the built-in Mac OS X word processor, by adding code to automatically add new text to a document, adding formatting and adding a word count. He then adapts this exercise to scripting Microsoft Word, which contains far more robust AppleScript support. The contrast is a good example of the range of AppleScript support between applications; some programs aren't AppleScriptable at all, while others offer varying degrees of support.

Chapter 5 includes a primer on file paths as an introduction to folder and file scripting (displaying and opening folders; moving, backing up, deleting and saving files). There are quite a few exercises here that train the reader in using the dictionary and becoming more adept with the AppleScript syntax.

Creating and manipulating lists is the subject of Chapter 6. It covers lists: nested lists, list commands and various ways of displaying lists. Goldstein creates a UNIX top-like/Activity Monitor AppleScript to display a simple list of running programs. This exercise leads into list processing and batch renaming which is the type of automation AppleScript excels at. Other list examples include joining, merging, inputting, and getting lists from other programs (TextEdit and MS Word are again the apps of choice). Lists are ubiquitous, and we spend an enormous amount of time organizing and sorting through them. Goldstein shows the reader how well AppleScript is suited to the task of manipulating lists quickly and efficiently.

The author moves on to another core application of AppleScript in Chapter 7: organizing and editing graphics. Graphics applications are highly scriptable, and Goldstein illustrates this with tutorials using iPhoto and Photoshop: creating new iPhoto albums, showing slideshows, color-correcting images automatically, filtering images, getting image dimensions and creating droplets. One of the most practical uses of AppleScript in this category is batch conversion of images from one format to another using Image Events. (You don't have to be a graphics professional to see how often anyone with a digital camera would make use of this script.)

Scripting sound and video apps is discussed in Chapter 8: manipulating tracks, converting song files, making your Mac speak to you and listen to you, showing full-screen QuickTime movies, rotating movies and embedding movies within scripts. For those with DVD-drive equipped Mac, Goldstein also unveils the AppleScript menu within the DVD Player app. For so many people who rely in iTunes to catalog their extensive music collection, there are very good scripts here for streamlining playing tracks, creating song ratings and performing song file conversions. The best video tip is using AppleScript to enable full-screen video within QuickTime Player, a feature normally available only if you upgrade to the Pro version.

Chapter 9, "Internet and Network Scripting," is chock-full of fun and useful scripts for Internet Connect, Safari, Address Book, Mail, iChat and Keychain. Goldstein shows the reader how to automate dial up an ISP, show Airport signal-strength fluctuations, view Web page source code, run AppleScripts from a Web page using Safari Services, use AppleScripts right in the Safari address bar, save scripts in the favorites bar, find contacts in Address Book, check for new and unread messages in Mail, create iChat controls, download and upload files, and recall passwords. The Power Users' Clinic aside is particularly interesting as it deals with using AppleScript to interact with Web Services using call soap or call xmlrpc. Goldstein provides resources and references for pursuing this advanced topic.

The final chapter in Part Two involves database scripting, including creating simple AppleScript databases and scripting FileMaker Pro databases using AppleScript to enter and sort data. Goldstein includes a nice FAQ on FileMaker's built-in ScriptMaker option.

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. Chapter 11 introduces folder actions to the AppleScript repertoire of advanced features. 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. Folder actions always bring to mind Sal Soghoian's (AppleScript Product Manager and Evangelist) lectures on AppleScript and some tricks to play on unsuspecting co-workers with folder actions. For example, a clueless user double-clicks a folder to open it and it opens and immediately closes ... If you're an IT manager, sometimes you just need to break up the monotony once in a while!

Dictionaries are revisited in Chapter 12 and the author addresses the unfortunate situation when an app doesn't have a dictionary, or has such a limited dictionary that it's effectively useless. Goldstein explains how to control these programs with Mac OS X's GUI Scripting feature, System Events (to automate the clicking of buttons or typing of keys instead of using commands) and Apple's UIElementInspector to discover an object's hierarchy (a download available from http://www.apple.com/applescript/uiscripting).

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.

Chapter 14 is titled "Testing and Debugging Scripts," and offers some advice and tools to handle errors that show up when you compile a script. Goldstein offers a handy table of common compiler errors and likely causes, error handling tricks (using a display dialog command and the log command) and tips on avoiding typical scripting errors like infinite loops, coercions and nonexistent items.

The author closes this chapter with a brief introduction to Xcode: how to download it, install it and use it to debug your scripts. Xcode is a much more powerful tool than Script Editor and therefore has better features and options for debugging. The reader should probably choose to revisit this section after the chapter that follows, on AppleScript Studio, where Xcode is handled with a bit more depth.

The final chapter in the book is "AppleScript Studio," where Goldstein creates a simple "SpeakToMe" project that contains a dialog box for typing in text, a pop-menu menu with Mac OS X system voices and a button labeled "Speak." This chapter is a very brief nod to AppleScript Studio (Xcode and Interface Builder) but gives the reader a taste for what application building with control over the GUI is all about. This is enough to pique the reader's interest and provides enough hands-on experience to engender confidence in using these tools.

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).

The Missing Manual series uses a nice layout style with a "soft" look; the pages have black tabs on light gray margins that identify the chapter topic and dark gray sidebars. Screenshots are enhanced with a shadow effect that raise the graphic off the page in a visually appealing manner. The notes, tips and boxed asides (Gem In The Rough, Workaround Workshop, Power Users' Clinic, etc.) are relevant, concise and often contain an element of humor; they don't detract at all from the flow of reading the main text. Each chapter has a gentle reminder that example scripts can be found on the Examples CD disk image that can be downloaded from the Missing Manual web site (http://www.missingmanual.com). References to definitions, tips, hints and other topics are indicated with a page number, not the usual "somewhere in the depths of chapter x". The Web site for the Missing Manual series (http://www.missingmanual.com) contains a link to "Missing CD-ROMs" where readers can download free and shareware applications described in the book series. For this particular book, the author has made a disk image available containing all the sample scripts used in the text examples. Errata can be found at O'Reilly's site (http://www.oreilly.com/catalog/applescripttmm/ind ex.html).

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" ratio 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 (http://www.goldfishsoft.com), 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.

Mary Norbury-Glaser is an IT Director at a University of Colorado Health Sciences affiliate center in Denver. Working in a multi-platform academic environment dominated by Windows boxes, she sometimes feels like the Mac Maytag Lady. You can purchase Applescript: The Missing Manual from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

171 comments

  1. article title by geoffspear · · Score: 3, Interesting

    Umm, did the submitter change his mind about which AppleScript book he was reviewing after typing in the title for his submission?

    --
    Don't blame me; I'm never given mod points.
    1. Re:article title by OglinTatas · · Score: 3, Interesting

      While she mentions two other books with the same subject, her actual review then starts with the line:

      "Goldstein's Missing Manual fills this gap with coverage of the current Mac OS 10.3 (Panther) release of AppleScript..."

      So my guess is no, she did not change her mind, though I hear that is a woman's prerogative.

    2. Re:article title by geoffspear · · Score: 1

      The problem is, she claims there are very few recent books on AppleScript, especially geared toward beginners, and then doesn't even MENTION the recent, geared toward beginners book in the title of the article. Unless being released 2 months ago makes "Beginning AppleScript" not recent enough.

      --
      Don't blame me; I'm never given mod points.
    3. Re:article title by damiangerous · · Score: 1

      The title of the submission is "Beginning Applescript", but the book being reviewed is actually AppleScript: The Missing Manual. A book named Beginning Applescript exists, and was published only two months ago so this is where "changing her mind" came from. Also, considering she's bemoaning the lack of recent books on AppleScript geared towards beginners there's a certain irony in her submission title actually being another AppleScript book that meets her criteria and of which she's apparently entirely unaware.

    4. Re:article title by OglinTatas · · Score: 1

      I see your point now. I didn't before because I read the article title merely as a description of the contents of the book, not as the title of a separate book with that title. I'm thinking it is coincidence.

  2. Its about time by Altus · · Score: 4, Insightful


    Applescript is one of the best things that apple ever produced... its power and simplicity is only undermined by the near total lack of documentation.

    I have always found it to be quite a shame that for all the effort apple is willing to put into applescript... that they have kept it from being as powerful a tool as it could be by keeping the learning curve so high for such an english like scripting language.

    Of course by the look of Tiger and the inclusion of Automator (which looks like it might just be an easy to use shell on top of applescript) this book might not be as necessary in a few months... look forward to Automator: The Missing Manual.

    --

    "In America, first you get the sugar, then you get the power, then you get the women..." -H. Simpson

    1. Re:Its about time by TheRaven64 · · Score: 2, Informative

      Agreed. AppleScript is the only language I have ever used that is easier to read than it is to write - and the reason it's so hard to write is that the documentation is scattered and unintelligible. Next to the Cocoa documentation it looks even worse.

      --
      I am TheRaven on Soylent News
    2. Re:Its about time by Tsiangkun · · Score: 3, Interesting

      Apple script is so easy to read, almost like english. Too bad when I try to script something from scratch, my guess at the english word that is expected is never right. Hopefully this will make applescript as easy to write as it is to read. I do most of my apple scripting in bash and perl nowadays anyway.

    3. Re:Its about time by hey! · · Score: 1

      But I wonder -- is this a technology whose time has come -- and gone?

      I did quite a bit of Applescripting back in the day. Letting scriptable apps loose on the internet makes me a bit nervous.

      Also, I wonder if something like javascript/Dom might take the place of Applescript.

      --
      Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    4. Re:Its about time by tijnbraun · · Score: 2, Interesting

      Wasn't Myst programmed in applescript?
      I clearly remember "the making of myst" that was included with a apple a roommate had bought (the game was included as well). The two bothers who made the game (forgot their names) talked about applescript or hypercards or something... I played the game wth my roommate and we really liked it... but i couldn't believe it was programmed in a scripting language.

    5. Re:Its about time by Altus · · Score: 4, Informative



      I believe the original myst was a hypercard stack (or at least that was the proof of concept) decked out with nice graphics.

      It is pretty unbelievable that something so successfull can come from something so simple... but thats why I have always liked applescript..

      --

      "In America, first you get the sugar, then you get the power, then you get the women..." -H. Simpson

    6. Re:Its about time by OECD · · Score: 2, Informative

      AppleScript is the only language I have ever used that is easier to read than it is to write

      I think they're ALL easier to read than write, but I know what you mean. It's easy to write a perfectly understandable statement that the interpreter can't handle. Personally, I think the problem is a lack of consistancy more than anything else. Scripting InDesign is VERY different than scripting Quark. That's not going to change, either, since so much depends on the way the application 'understands' the data.

      What's really missing is an easy front end, like HyperCard used to provide. AppleScript Studio (unfortunate abbreviation, that) is a bit more complex than necessary.

      --
      One man's -1 Flamebait is another man's +5 Funny.
    7. Re:Its about time by Megane · · Score: 2, Informative

      While Hypertalk was esentially the predecessor of AppleScript, it was not the same thing. Hypertalk only worked in Hypercard (and Supercard) stacks. Myst used a Hypercard runtime with some xcmds (external command modules) added to it.

      --
      #naabhaprzrag, #sverubfr-000, #agi-fcbafberq, negvpyr[pynff*=' negvpyr-ary-'] { qvfcynl: abar !vzcbegnag; }
    8. Re:Its about time by mattkime · · Score: 1

      its power and simplicity is only undermined by the near total lack of documentation.



      ....just like WebObjects.



      Apple really doesn't know how to market and support developer tools. Often times the best way to learn about apple tools is to find the right non-apple listserv or message board.

      --
      Know what I like about atheists? I've yet to meet one that believes God is on their side.
    9. Re:Its about time by Altus · · Score: 1



      I guess... I never really had much trouble with web objects... or any of the rest of apples dev tools...

      sure the Cocoa API docs are a little weak... but so is MSDN if you ask me.... and I think apples code samples are much more useful than anything else I have found.

      not that apple is without sin... their docs could all be much better... but only applescript stands out for me as the worst of the bunch...

      even worse is the fact that its really a tool for non programmers... you just cant expect a non programmer to get by on trial and error.

      --

      "In America, first you get the sugar, then you get the power, then you get the women..." -H. Simpson

    10. Re:Its about time by myov · · Score: 2, Interesting

      Some of the Dictionaries have been really complicated. Really un-Apple of Apple. But, in many cases you can hit the Record button, and it will build the script as you perform the actions.

      --
      I use Macs to up my productivity, so up yours Microsoft!
    11. Re:Its about time by sh00z · · Score: 2, Funny
      Too bad when I try to script something from scratch, my guess at the english word that is expected is never right.
      Amen. I remember my first attempt, circa 1996. I wanted a task to repeat every few minutes, pausing between loops. But what on earth could the AppleScript command be? Pause? No. Wait? No. Hold? No. It's idle. Ah. So simple, and yet so obscure.
    12. Re:Its about time by zbrimhall · · Score: 2, Interesting

      The original Myst was indeed a set of standalone HyperCard stack. I used to use a "cheat code" which consisted of typing 'Command-?' A dialogue box would appear, complaining that it couldn't find "HyperCard Help Stack," and giving asking you to find the help stack in an Open File... dialogue. Thing is, the different Myst Ages were just different stacks which, while normally hidden, were visible in the Open File... dialogue. Select your desired Age and voila--instant warp!

      Not that this exactly ruined the ending or anything. You could warp to the last age, where old whats-his-name would ask you for the white page, and you'd be all like WTF?? and warp back to the main island to actually figure the damn game out for yourself.

    13. Re:Its about time by jlaxson · · Score: 2, Insightful

      No, it has most certainly not come and gone. Automator is going to take applescript to new levels. In addition, AppleScript isn't a one-shot thing. It operates on top of apple's "Open Scripting Architecture." You can write OSA scripts in any language you have an interpreter/compiler plugin for. There's only one I know of, for javascript, but in theory you could write a plugin for any language. Python, F:Script, anything.

      --
      On Apple Input Peripherals: They're okay, I guess, but I was really hoping for a one-key keyboard and a 109-button mouse
    14. Re:Its about time by matthaak · · Score: 1

      I agree its amazing what was accomplished with HyperCard. I didn't know the original Myst was just a HyperCard stack. I should point out though that HyperCard stacks aren't necessarily authored with AppleScript. In fact, its more likely that they're authored in HyperTalk, the native language of HyperCard and in many ways as readable as AppleScript.

  3. Scripting Cron? by OECD · · Score: 2, Interesting

    ...use an AppleScript to run cron every day,...

    Shouldn't that be the other way 'round? Or am I missing somethinig?

    --
    One man's -1 Flamebait is another man's +5 Funny.
    1. Re:Scripting Cron? by Trurl's+Machine · · Score: 2, Informative

      >...use an AppleScript to run cron every day,...

      Shouldn't that be the other way 'round? Or am I missing somethinig?


      Either way you want it, my friend. In MacOS X, you can integrate the gumdropesque beauty of GUI tools with the strange world of Unix under the hood. You can launch AppleScript from cron script or a shell script from AppleScript. To do the former all it takes is to place a command "open foo", where "foo" is your script written in AppleScript ("open foo" generally equals to double-click on foo's icon). To do the latter just include "Tell application Terminal to do script with command bar" in your AppleScript (this would equal to typing bar in your Terminal window).

    2. Re:Scripting Cron? by xtermin8 · · Score: 1

      I imagine he wrote an applescript with a little clickable icon so that he doesn't have to go to a terminal and type c-r-o-n. Perhaps a dubious achievement, but if it makes him happy...

    3. Re:Scripting Cron? by geoffspear · · Score: 1

      Ok, but why would anyone be running cron from the terminal in the first place? If your cron process is dying often enough that you need a GUI icon to restart it, there's something seriously wrong with your machine.

      --
      Don't blame me; I'm never given mod points.
    4. Re:Scripting Cron? by mindstrm · · Score: 1

      At a guess, it's because he has a laptop, and there are some defaultl maintenance cronjobs on osx that will only run if the machine happens to be on at the appropriate time.

      This means that for laptop users, often daily weekly and monthly cron tasks are sometimes not run for quite some time, degrading system performance.

    5. Re:Scripting Cron? by BorgCopyeditor · · Score: 1

      Or maybe it performs a service something like anacron. My computer is seldom running when cron wants to do its magic, and if it is running, I'm usually using it and don't want a cron job running. What a predicament!

      --
      Shop as usual. And avoid panic buying.
    6. Re:Scripting Cron? by JQuick · · Score: 1


      This means that for laptop users, often daily weekly and monthly cron tasks are sometimes not run for quite some time, degrading system performance.


      That is a load of BS perpetuated by several authors of irrelevant and purposeless shareware to perform OSX maintenance.

      The periodic subsystem jobs clear out and rotate old log files and rebuild the locate database. These have no impact on general system performance.

      Equally silly is the advice to periodically removing cache files or dot files, or run scripts to "fix permissions" or redo prebinding,

    7. Re:Scripting Cron? by godglike · · Score: 1

      I certainly use it the other way around. Cron + Applescript + iTunes makes an excellent alarm clock.

      Conversely cron+AppleScript+Speech means my iBook can tell me to stop coding and get some sleep late at night.

    8. Re:Scripting Cron? by Eravau · · Score: 2, Informative
      If you want to call an AppleScript command from a shell script, you don't need to open it (which will essentially call it from the Finder). You can run it from the shell with the osascript command. e.g.:
      osascript -e 'tell application "Stupid App" to quit'
      osascript /path/to/applescript_script_as_text
      You can pass data back to the shell by including a return statement in your AppleScript code (something like a subroutine in some languages). In the same way, you can call a shell command/script from AppleScript without having to invoke the Terminal app (or ever even seeing from the user perspective that anything but AppleScript was ever used). Use the do shell script command. e.g.:
      set up_time to (do shell script "uptime")
      display dialog up_time
      And it'll display the results of the uptime command in a typical GUI dialog box without the user ever seeing a CLI.

      Seamlessly passing data back and forth between AppleScript and shell processes is a beautiful and useful thing for writing scripts to adjust CLI parameters for users that are CLI-phobic.
    9. Re:Scripting Cron? by mindstrm · · Score: 1

      OH really.

      Well, I like my locate database up to date, thanks. I use it a lot.

      I also like my logs in some semblance of order.

      Perhaps you are using too narrow a definition of system performance?

    10. Re:Scripting Cron? by JQuick · · Score: 1

      Yes, really.

      I also prefer that locate.updatedb run regularly and that
      certain log files be partitioned evenly on date boundaries.

      However, these are clearly aspects of system functionality not system performance.

    11. Re:Scripting Cron? by Em+Adespoton · · Score: 1

      Two words: install anacron.

    12. Re:Scripting Cron? by angel'o'sphere · · Score: 1

      I imagine he wrote ...

      You don't imagine enough.

      Cron is fine for unix or linux. Especially if you are a geek. Why? Its powerfull and has its own "script file syntax".

      A treu geek programs in sh/bash, awk, sometimes even sed, regulary in m4 in modern days also in perl. But thats not geeky enough, so you of course know basic PHP, but dive into Python and also into Ruby. Java is evil of course and offers nothing you can not find in a similar way in Python or Ruby anyway.

      But back to your imagination ....

      The original poster you refer to was atalking about iCal ... as replacement for cron, which executes AppleScrips.

      *I* for my part could imagien that you take iCal, what is a calendar application, and enter an event. Probably an event which is happening every week on monday, or allways on second tuesday every month.

      But that "event" is not an appointment, but teh execution of an AppleScript.

      You know :D true artists, don't need obscure languages ... they use every application for what it is designed for and place AppleScripts all over the places like a magician casts ists spells.

      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  4. Scripty Goodness by Stanistani · · Score: 5, Interesting

    Not being a Mac person myself (although I am eyeing the Mini as a starter) I ask:
    are there AppleScript security vulnerabilites?

    1. Re:Scripty Goodness by kiwidefunkt · · Score: 5, Funny

      No. If you read back a few stories, you'll see only .NET and JVM have security vulnerabilites.

      --
      www.kiwilyrics.com - a wiki for lyrics
    2. Re:Scripty Goodness by Anonymous Coward · · Score: 0

      Only in that AppleScript can do everything that a user normally would be able to do. It's a very powerful language in that respect, and potentially dangerous if you don't know what you're doing. Of course, the same could be said of opening a shell.

    3. Re:Scripty Goodness by NMerriam · · Score: 4, Informative

      Not in the sense of VBScript or similar Windows issues. Applescripts don't run automatically, you can't email them to somebody and have it delete their home directory without their participation, or put it on a web page and use an IE exploit to get root-level access to the system.

      But yes, it's a powerful scripting language, so it can do all the bad stuff your user account can do. OSX is so flexible on language that you can pretty much use anything you can think of (AppleScript, perl, python, [ba|c]sh, etc) in a single script, so all the stuff you can do with those languages and shells are possible in a script.

      There was a debate over on MacOSXhints.com a week or two ago debating whether Apple should somehow try to "protect" people from malicious scripts, but there doesn't seem to be any sensible way to have a functional scripting language that isn't capable of doing damage when used improperly.

      --
      Recursive: Adj. See Recursive.
    4. Re:Scripty Goodness by Orne · · Score: 1

      Not in the sense of VBScript or similar Windows issues. Applescripts don't run automatically, you can't email them to somebody and have it delete their home directory without their participation, or put it on a web page and use an IE exploit to get root-level access to the system.

      Yet. How long will it be before there's a <SCRIPT LANGUAGE="AppleScript"> addition to the next version of IE for Macs? Welcome to the world of Windows issues. The only reason it hasn't been done yet is that the language hasn't generated enough followers for it to be worth someone's while to abuse it.

    5. Re:Scripty Goodness by cowscows · · Score: 2, Insightful

      Microsoft discontinued IE for macs. I don't think Apple would be dumb enough to add something like that to Safari.

      Even if macs somehow gained 10-20% market share over the next few years, it wouldn't make much sense for websites to require it. Pages require such an operating system specific function will only occur when you've got 95%+ marketshare for a single browser, which we're unlikely to ever see again.

      --

      One time I threw a brick at a duck.

    6. Re:Scripty Goodness by Altus · · Score: 2, Interesting



      In addition to your good points... Im not sure applescript can do as much damage as VB script even if apple did add this to safari.

      i havent tried this, but doesnt applescript require an admin password to do any of the things that a user needs a password for? I mean, it could wipe out user data but not the system, at least without the user putting in the admin password?

      I could be totally wrong here... like I said, I havnt tested it... but thats certainly the way it should work.

      --

      "In America, first you get the sugar, then you get the power, then you get the women..." -H. Simpson

    7. Re:Scripty Goodness by NMerriam · · Score: 1

      Yet. How long will it be before there's a addition to the next version of IE for Macs? Welcome to the world of Windows issues. The only reason it hasn't been done yet is that the language hasn't generated enough followers for it to be worth someone's while to abuse it.

      Even if there were such web-enabled support, it would all still be limited by the BSD permissions. Windows runs the default user as root. Not only does OSX have root completely disabled by default, you'll be asked for the administrator password anytime something wants to write to any of the system directories.

      It's no different than writing a malicious script for a Linux system (except that it's a lot less likey on the Mac that the person has superuser access).

      --
      Recursive: Adj. See Recursive.
    8. Re:Scripty Goodness by BorgCopyeditor · · Score: 1
      I don't think Apple would be dumb enough to add something like that to Safari.

      But wasn't there something using the help:// protocol that was fixed by a security update this fall or summer?

      Ah, yes. Here it is.

      --
      Shop as usual. And avoid panic buying.
    9. Re:Scripty Goodness by myov · · Score: 1

      Back in OS 8/9, I had a setup script for new machines fresh from Apple (it didn't make sense to image my machines). Among other things, it would go around trashing extensions/leftovers/AOL, disable printers Apple hadn't shipped in years, rename the workstation, copy a bunch of default prefs, setup file sharing including owner name/pass etc.

      I always used the "move to trash" command rather than a complete delete in case it blew up, but there was nothing stopping me. If I ran something like "select folder "System Folder" of startup disk; move selection to trash; empty trash" the computer was happy to do it.

      --
      I use Macs to up my productivity, so up yours Microsoft!
    10. Re:Scripty Goodness by Anonymous Coward · · Score: 0

      Except -- You cant trash the system folder of an active disk. It wont allow you. It may put it in there (I dont even think it would do this) but it definatly wont let you empty (file in use).

      Get your FUD straight!

    11. Re:Scripty Goodness by NMerriam · · Score: 1

      And that lousy security is part of why i left the Mac around OS 8 (went to NT, 2k, and BSD) and came back at 10.2 :)

      I do have a couple of scripts that delete stuff automatically, and of course have been bitten by the inadvertant wrongly-placed rm-r, so when I came (back) to the Mac I was happy to be able to mv ~/.trash in all my automated (and contextual) scripts.

      --
      Recursive: Adj. See Recursive.
    12. Re:Scripty Goodness by NutscrapeSucks · · Score: 1

      Applescripts don't run automatically, you can't email them to somebody and have it delete their home directory without their participation

      You know, the famous ILOVEYOU.vbs and other script viruses didn't run automatically either -- one had to click on it and dimiss a warning. Furthermore, those viruses rarely required Administrator rights, they ususally just sent mail and copied themselves wilynily.

      I see no difference between OS X and Windows in this department. EXECPT for the fact that people are scanning for Windows trojans, so when one hits the Mac world, they'll be unprotected.

      --
      Whenever I hear the word 'Innovation', I reach for my pistol.
    13. Re:Scripty Goodness by miu · · Score: 1
      Been a while since I used outlook, but I seem to remember at least some of those script viruses took advantage of a preview pane that would execute embedded material without requiring any action from the user.

      I agree that run of the mill Mac users aren't any smarter than Windows users and that most users will click 'okay' to get rid of a dialogue without reading it. An 'always ask the user policy' is irresponsible, the user probably doesn't know and doesn't understand.

      --

      [Set Cain on fire and steal his lute.]
    14. Re:Scripty Goodness by NutscrapeSucks · · Score: 1

      That was a buffer overflow bug in Outlook and nothing to do with the script engine - it was just a VBS payload instead of an EXE.

      Everytime this comes up on Mac boards, people accept that ILOVEYOU:Mac is possible, but there probably won't be any urgency to fix it until it happens.

      --
      Whenever I hear the word 'Innovation', I reach for my pistol.
    15. Re:Scripty Goodness by Anonymous Coward · · Score: 0

      Close enough. You could grab the key files of a system folder and scatter them all over the Mac such that it would be unbootable.

    16. Re:Scripty Goodness by frankie · · Score: 1

      Social infection is one step harder on a Mac. An attachment sitting in your mailbox (or a download from a web site) cannot be an executable. It has to be a document/archive format.

      In the case of AppleScript, you would either need to zip/sit/dmg/gz the runtime script (extract then execute) or send the source file (open in Script Editor then press Run)

      Are most users dumb enough to take that extra step? Yes probably. But it's not just a "one click and you're hosed" process.

    17. Re:Scripty Goodness by NutscrapeSucks · · Score: 1

      And you've tried it? Because it works fine here on Apple Mail 10.3. No warning message even.

      (PS: Unlike HTTP, email has been able to handle forked Mac files for a long time)
      (PPS: OS X doesn't really need forked files or Mac metadata, a .scpt file or a "Mach-O" executable is good enough.)
      (PPPS: If you send a .app directory, Apple Mail even ZIPs it up for you behind the scenes. However it doesn't run from Mail like a Carbon app)

      --
      Whenever I hear the word 'Innovation', I reach for my pistol.
    18. Re:Scripty Goodness by frankie · · Score: 1

      And you've tried it?

      I haven't tried sending a raw executable in Mail.app, but I did try .scpt attachments. They open in Script Editor.

      No warning message even.

      That definitely shouldn't happen. 10.3.recent added a warning dialog for the first time you run an application. If Mail.app doesn't do it, that's a security bug that should be reported.

    19. Re:Scripty Goodness by NutscrapeSucks · · Score: 1

      That's funny. I sent several from the AppleScript sample folder, and they all just ran. I'll try sending a few to my Mac-comrades.

      --
      Whenever I hear the word 'Innovation', I reach for my pistol.
  5. Dear Linux: The Missing Manual by Letter · · Score: 2, Insightful
    Dear Linux: The Missing Manual,

    aka RTFM.

    Letter

  6. Umm... by Anonymous Coward · · Score: 0

    Umm, did the submitter change his mind about which AppleScript book he was reviewing after typing in the title for his submission?

    reviewer: Mary Norbury-Glaser
    ...
    she sometimes feels like the Mac Maytag Lady

    Umm, did the poster read the review or summary before using inappropriate pronouns?

    1. Re:Umm... by HTTP+Error+403+403.9 · · Score: 4, Funny

      tell MaryNorburyGlaser set its gender to "male" end tell

      --
      I'm not a Troll, it's reverse psychology.
    2. Re:Umm... by geoffspear · · Score: 3, Funny

      It's obviously a pseudonym. Everyone knows there are no women on slashdot.

      --
      Don't blame me; I'm never given mod points.
    3. Re:Umm... by Hanji · · Score: 1

      Error: Expected end of line, got "end tell"

      --
      A Minesweeper clone that doesn't suck
    4. Re:Umm... by LakeSolon · · Score: 2, Funny

      tell MaryNorburyGlaser to set its gender to male

    5. Re:Umm... by emilymildew · · Score: 3, Funny

      Don't tell my boyfriend that.

    6. Re:Umm... by Ohreally_factor · · Score: 1

      I don't know why you stay with him, if he doesn't have the common decency to give you a reach around.

      --
      It's not offtopic, dumbass. It's orthogonal.
    7. Re:Umm... by bar-agent · · Score: 1
      There are no women on Slashdot
      Don't tell my boyfriend that.

      I won't, but shouldn't you be honest with him?

      "I know all there is to know, about the crying game /
      I've had my share of the crying game"


      Heh.
      --
      i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
  7. A neat use by nate+nice · · Score: 4, Informative

    IS to use Applescripts embedded in a Cocoa program. I forget the exact syntax but it's similar to using the system() in a C program. It's also easy to make your program scriptable by making available certain variables and then allowing your Cocoa program to read in an Applescript and execute it on the variable(s)the scripter wants to manipulate.

    I remember years back writing a simple Cocoa program that would automate things, stop and start programs, etc using nothing but Applescripts inside the program.

    These are things you can do with typical ANSI C in your program to, forking off process', killing process', etc but it's a lot easier to have a script that says something like:
    tell Application 'Finder' to quit PROGRAM

    instead of checking if a program is running by asking the system, using a grep fork with a regex to see if it is running and then telling the system to quit it or start it if it isn't running, etc.

    Hell, you could even make a variable PROGRAM and then have users simply enter the programs they want to start/stop and at what time and then have your program run via Applescript at the correct times to start/stop a program based on the string PROGRAM.

    Personally I'd use cron, but hey, this is why we make nice little GUI programs for the other people.

    --
    "If you are a dreamer, a wisher, a liar, A hope-er, a pray-er, a magic bean buyer ..."
    1. Re:A neat use by LakeSolon · · Score: 1
      new NSAppleScript("get duration of current track").execute(new NSMutableDictionary());
      That works when using Java against Cocoa (to mix even more languages). I happen to be working on an iPod-like interface to iTunes for touch screens today. It's for a car install. Link.

      Though I have been having a weird issue where a script that compiled fine (it auto-compiles the script on execute if it isn't already) dozens of times 500ms apart, will spontaneously fail to compile. I was recompiling each time through the update loop when in testing and now caching the scripts has reduced the frequency of occurrence of the issue to be undetectable. But I'm still not thrilled.

      ~Lake
    2. Re:A neat use by LakeSolon · · Score: 1

      Feh, I meant to hit the preview button, went to edit the example script into something that actually works (Like "tell application itunes to get duration of current track"), and there was no edit field. Ah well.

      ~Lake

    3. Re:A neat use by nate+nice · · Score: 1

      Don't you mean, NSEditField(). :P

      --
      "If you are a dreamer, a wisher, a liar, A hope-er, a pray-er, a magic bean buyer ..."
  8. Syntax & Grammar by bwcarty · · Score: 5, Insightful

    AppleScript mimics the syntax of English. As such, its grammar by intent should be easy for English speakers to grasp

    The key word here is should. How many English speakers truly understand the grammar and syntax rules of their own language, particularly the written version?

    1. Re:Syntax & Grammar by SmokeHalo · · Score: 0

      I try, but sometimes understanding it I cannot. I could care less though its not like scripting is it's own reward.

      --
      I'm not good in groups. It's difficult to work in a group when you're omnipotent. - Q
    2. Re:Syntax & Grammar by eobanb · · Score: 1

      Well enough to understand AppleScript, certainly. The genius and uniqueness of AppleScript becomes apparent when you actually look at code. tell application Finder, if (variable) is equal to (value) then, display dialog box "Hello World" buttons "OK", end if, end tell. End of argument.

      --

      Take off every sig. For great justice.

    3. Re:Syntax & Grammar by grunherz · · Score: 2, Funny

      Your [sic] right.

      Most native English speakers cant[sic] even properly use there [sic] own language in proper context.

      Its[sic] really depressing; not to mention annoying as hell.

      I love Applescript though. It helps me to use my system real good [sic].

      --
      Four weeks, Twenty papers, that's two dollars ... plus tip.
    4. Re:Syntax & Grammar by Anonymous Coward · · Score: 0

      I think most of us does.

    5. Re:Syntax & Grammar by bonch · · Score: 1

      Well, if you lack the ability to understand the syntax of a language, you probably wouldn't be programming a computer anyway, would you?

  9. Yet another chatty beginner's guide? by dpbsmith · · Score: 4, Insightful

    ...I already have Ethan Wilde's "AppleScript for the Internet" and Matt Neuberg's "AppleScript: The Definitive Guide" (an O'Reilly, with a Boston Terrier on the cover). And a couple of Apple PDFs.

    What we really need is a fully grown-up guide that is truly definitive, with proper descriptions of the never-quite-explained object model behind AppleScript that is rigorous and complete--and that includes the functionality provided in Apple-supplied AppleScript extensions and in the Finder.

    I want something at an Inside Macintosh level, or a Harbison and Steele level; not a Danny Goodman level or even a man-page level.

    Neuberg's book is the best I've seen so far. He makes the right promise, but doesn't quite deliver. It is all too obvious that he is charting his personal voyage of discovery.

    I know I should not comment on Goldstein's book without at least having browsed through it in a bookstore, but it sounds as if it is just one of another AppleScript books that will be full of magic snippets I can use, never quite understanding why they work, or why they fail... exactly what all the quoting rules are... and so forth.

    1. Re:Yet another chatty beginner's guide? by bsd4me · · Score: 1

      Yeah. I really wish that O'Reilly would get back to its roots and publish book geared for advanced users (and not users who think they are advanced). Even the Definitive Guide pales in comparison to the coverage in the original X series, or the other early books.

      --

      (S(SKK)(SKK))(S(SKK)(SKK))

    2. Re:Yet another chatty beginner's guide? by miu · · Score: 1
      A wildly successful advanced computer book like 'The C Programming Language' or 'UNIX Network Programming' will take years to match the sales that a mildly successful book aimed at new users can make within months.

      Also, when 'Programming Perl', 'Lex and Yacc', 'Sendmail: TDG' and the other classic O'Reilly books came out they were aimed at the accidental system admin/programmer. The new books are a little more mass market, but the audience is not much less technical than those first books.

      --

      [Set Cain on fire and steal his lute.]
  10. Applescript is such an asstastic language ... by jkujawa · · Score: 2, Informative

    Fortunately, you don't have to use it to get the full functionality of the Open Scripting Architecture.

    You can use it from python, for instance. You need to generate an interface object from the AppleScript dictionary of anything you want to use, but then it's pretty straightforward.

    For iTunes (and using a fink-provided python, but the shipped one will work as well):

    pythonw /sw/lib/python2.3/plat-mac/gensuitemodule.py \
    --output iTunes --resource --creator hook \ /Applications/iTunes.app/Contents/Resources/iTunes .rsrc

    [Source]

    This makes a module called iTunes.

    Then you can use it trivially. You have to use the pythonw instead of the python executable (due to some interaction with the OS X window manager):

    >>> import iTunes
    >>> app = iTunes.iTunes()
    >>> library = iTunes.library_playlist(1)
    >>> num = app.count(library, each=iTunes.track)
    >>> num
    9365
    >>> for i in range(1, num+1): ... trk = library.file_track(i) ... print app.get(trk.name)

    1. Re:Applescript is such an asstastic language ... by beelsebob · · Score: 1
      I can't remember the exact syntax, but I'm fairly certain that the applescript for the above would be

      tell application "iTunes" to print the name of each item in the library

      So what exactly are you saying is asstastic about it? The above seems to be an awful lot simpler, and clearer than your python.

    2. Re:Applescript is such an asstastic language ... by jkujawa · · Score: 1

      To do any real work in applescript requires a hideous amount of typing. It's sickeningly verbose.

    3. Re:Applescript is such an asstastic language ... by beelsebob · · Score: 1

      So you're saying that the example there was hideously verbose? Come on... the applescript is shorter than the command to get python even to recognize iTunes.

    4. Re:Applescript is such an asstastic language ... by revscat · · Score: 2, Insightful

      I guess that I would argue that AppleScript isn't meant for "real" work; that's for Python, Java, Objective C, etc. AppleScript is a scripting language, after all, and therefore my expectations aren't too high for it. I expect it do be able to do simple tasks quickly, and for harder things to be difficult if not impossible.

    5. Re:Applescript is such an asstastic language ... by Anonymous Coward · · Score: 0

      Gensuitemodule is an ugly lump of clunky old junk that no self-respecting application scripter should go within 100 feet of. Here's your iTunes example written in its spanky new nemesis:

      #!/usr/bin/pythonw

      from appscript import *

      library = app('iTunes').library_playlists[1]
      print library.count(each=k.track)
      print '\n'.join(library.file_tracks.name.get())

      has

  11. Oh, all right, mod me down... by dpbsmith · · Score: 1

    Yeah... I shouldn't knock it for being a self-acknowledged beginner's level. And, yes, I need to take a look at the Hanaan Rosenthal book the reviewer mentions.

  12. I've never used Applescript... by Biomechanical · · Score: 4, Interesting

    Having never owned a Mac, but I'd like to comment on the books, the "missing manuals", and the literature that you can find online.

    Owning a detailed, well laid out reference manual to scripting, programming, your OS of choice, and other parts of your computer is always a handy thing, but why don't they ever publish manuals in a three or four ring binder, or unbound with the holes punched for readily inserting into a binder?

    Not all aspects of computing change as rapidly as others. A manual explaining how a transistor works and how to build one would still be as valid today as it was when transistors were first created, even if only to the hobbiest electrician, but my two books on Debian GNU/Linux are now rather dated in areas.

    What I'd like to see publishers do is provide people with the option to order "binder format" - "Would you like that in 3 or 4 ring? A4, Letter, or A5?" - editions of books, so that when the subject matter changed, the publisher could provide the updated chapter(s) all nicely prepared to simply insert in your binder, or you could even download/rewrite the chapters yourself.

    It's not such a stretch to see that in this information age as much as we need readily upgradeable software and hardware, we should also have readily upgradeable manuals to go with it.

    --
    His name is Robert Paulsen...
    1. Re:I've never used Applescript... by MrP-(at+work) · · Score: 1

      I have several BASIC books for my TI 99/4A from the 80s.. And that's how they were back then, in big 3 ring binders.

      Wonder why that stopped

      --
      [an error occurred while processing this directive]
    2. Re:I've never used Applescript... by Anonymous Coward · · Score: 0

      Yeah, the problem is it becomes all too easy to Xerox those removable pages, punch some holes, and flagrantly ignore copyright. Those publishers like to make money...

    3. Re:I've never used Applescript... by Baricom · · Score: 2, Informative

      I wish they did, too. Here's why I think they don't:

      1. Pages get lost and damaged due to the constant sliding of the holes as the pages are turned.
      2. The book becomes trivial to scan or photocopy.
      3. Providing "updated chapter(s)" means there's no incentive to buy the more expensive updated edition.
      4. Multiple page sizes would be a pain to keep in sync.
    4. Re:I've never used Applescript... by myov · · Score: 1

      One of the Amiga releases did this (wow... that's going back). I can remember buying a system update and needing to go through the manual inserting/removing pages.

      It might have been workbench 2.0, although 2.1 shipped as a boxed set of 4 bound manuals. My first machine ran 1.3, but with either stickers or a smaller update book listing the sections to ignore in the 1.2 book.

      --
      I use Macs to up my productivity, so up yours Microsoft!
    5. Re:I've never used Applescript... by Biomechanical · · Score: 2, Insightful

      I wish they did, too. Here's why I think they don't:

      1. Pages get lost and damaged due to the constant sliding of the holes as the pages are turned.
      2. The book becomes trivial to scan or photocopy.
      3. Providing "updated chapter(s)" means there's no incentive to buy the more expensive updated edition.
      4. Multiple page sizes would be a pain to keep in sync.

      1. A thin but durable plastic strip stuck to one side of each page would easily add strength to the holes and help prevent breakage.

      2. It's trivial to scan or photocopy now. Either the book is very large, and is made with the cloth and glue style binding which can be opened nearly flat on a flat surface, or it's a straight glue bind, and is easy to remove the pages.

      3. Each replacement chapter could be priced at it's percentage of the complete book, i.e., if it's a 20 page chapter in a 100 page book that costs $50, then the cost of replacement of that chapter could be $10.

      This has the added advantage to the publisher that while a person pays per page for the first edition, and the publisher is making a slight loss on the binder, subsequent updates are actually costing slightly more to the consumer - by maybe a few cents - because they're only buying the updated pages.

      4. A page numbering system of (chapternumber).(section).(subsection) could be used instead of the traditional "i to v" (introduction) and "1 to 237" (content), like a lot of online technical help documents I've seen.

      At the bottom outer corners of each page - or top, it doesn't really matter on the layout - there could be "4.3.1" (Chapter 4, Section 3, Subsection 1) which could be listed in the contents as "4. Core Functions", "4.3. The IF command", "4.3.1. Examples of Correct Usage".

      Okay, minor addendum to idea. You get the replacement chapters AND the updated contents. :)

      I don't think it'll happen though, not unless I publish my own books and, let's face it, I'm not a writer.

      --
      His name is Robert Paulsen...
    6. Re:I've never used Applescript... by GimliGloin · · Score: 1

      but why don't they ever publish manuals in a three or four ring binder, or unbound with the holes punched for readily inserting into a binder?

      Because the pages would rip out very easily.
      Because it would be easy to feed the entire manual into the xerox feeder and thus easily make copies for free
      Because having lots of computer books in ones book shelf makes one look like they know alot, having lots of loose-leaf papers in a peechee folders or notebooks makes you look like a nerd (hey, this is news for nerds though)
      Because that is the way DEC shipped their VMS docs. Where is DEC today?

      GSG

    7. Re:I've never used Applescript... by hcdejong · · Score: 1

      1. You just multiplied the per-page price. Instead of using stock paper, you'll have to custom-produce it. It also won't fit in a standard press anymore.

      3. Except that the cost of offering separate chapters isn't a percentage of offering the complete book. Let's say there are 10 chapters. Offering all of them means you get to pay initial costs (setup cost for the press, production of the source, etc.) ten times instead of one. Also, with loose-leaf chapters you get more overhead: the chapters need more handling to make them transport-ready, etc.
      The logistics are a nightmare. A bookstore will have to keep track of 10 items instead of one.

      4. That page numbering system sucks. Finding page 237 is a whole lot easier than finding page 5.42.
      And that still leaves you with the point the grandparent made: supplying a book in multiple page sizes is a pain (telling someone he can find the information on "page 237" isn't going to work because he may have a different-sized edition).

      Also, when offering per-chapter updates:
      5. Cross-references between chapters are no longer possible, because you can't be sure which version of a chapter the customer will have.

      I've used a system like this. I had to produce addenda for naval electronics: the kind of system that has several meters of shelf space worth of documentation. Producing the incremental updates, plus a change log (to tell the customer where the new pages were supposed to go) was a PITA and cost a lot of time, and engineers returning from site visits would tell us the documentation upgrades would invariably end up stacked on a shelf, instead of being added to the binder. Eventually we started shipping whole manuals instead, even if only 10 pages out of 1000 were changed.

      (Yes, I am a writer)

    8. Re:I've never used Applescript... by hcdejong · · Score: 1

      Upgradeable manuals are beginning to gain popularity. See the Take Control series of books, for instance.
      The upgrades are electronic (PDF) instead of dead tree, and that's what makes the upgrade feasible:
      - shipping an upgrade of the whole book, on paper, would make the upgrade as expensive as the original book.
      - shipping a 'binder format' doesn't work either (other post have detailed why not).
      With a PDF, you can include the whole book, properly updated (with correct TOC, index and cross-references), for very little cost.

      Online formats (be it PDF or pure online formats like HTML or a Help file) make more sense for a reference manual than paper, anyway. For this kind of information, the extra features you gain (full-text search, clickable links, copy-and-paste of code snippets etc.) outweigh the 'read from cover to cover' comfort factor a paper book has.

    9. Re:I've never used Applescript... by carou · · Score: 1

      Because it would be easy to feed the entire manual into the xerox feeder and thus easily make copies for free

      For free? Tell me more about this copier machine which doesn't need to be kept fed with paper and toner...

    10. Re:I've never used Applescript... by torpor · · Score: 1

      i remember in the good old days of MIPS RISCos, every system shipped with a complete 3-ring binder set of man pages, and every few months or so, MIPS would send us new packages of pages to be replaced in the manuals (as bugs were fixed/apps upgraded) .. at first it always seemed cool that we'd get these 'revised docs', but as the ops-room flunky i do remember groaning about having to 'update deadtree manuals' all the time, for each system (the ops director was anal about each machine having its own doc shelf...)

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  13. I'd be more interested... by fussili · · Score: 1

    in a more systematic volume that just explained Applescript the way that most programming languages are explained. I've only found one free PDF download made by a 3rd party that came close to explaining an Applescript pre-written routine and how to call one. Also developers ought to be doing more to hook Applescript into their applications - so many times I've been thwarted by a lack of scriptability. Overall Applescript rocks, in spite of the absence of decent documentation. However I'm going to hold judgment on whether this book is worth spending my money on - it doesn't really seem like that kind of documentation I'm looking for.

  14. tempting by Doc+Ruby · · Score: 3, Interesting

    AppleScript is poorly documented, incompletely implemented, and unevenly supported by developer tools. But even its basics are extremely powerful. Along with Apple's required "File" and "Edit" menus (and their command items) for all apps, is their corresponding AppleEvents, supported by a generic enough AppleScript interface that other languages can bind to them. So Apple apps have a reliable, even if often rudimentary, IPC mechanism. Even though Mac apps are known for their GUI, the AppleEvent interface means that they can be chained together as tools, with a wrapper, or just a network (or other IPC) API. Linux has some competing technologies, but it really could benefit from as simple, predictable and consistently available IPC interface as AppleEvents.

    --

    --
    make install -not war

  15. Re:Longest summary ever? by eobanb · · Score: 1

    Do you even read Slashdot? This isn't a summary, it's a book review. Have a look at past book reviews, and you'll see that they're all about this length...

    --

    Take off every sig. For great justice.

  16. Re:Ummm. by l4m3z0r · · Score: 4, Insightful
    Let me know when "Windows XP Security Administration: The Missing Manual" gets published. I'll buy twenty copies and have my Christmas shopping for next year done (for my PC-owning friends and relatives, anyway.)

    Cool, I'm sure your pals will all love a book about how to use features that don't exist.

  17. Yeah it's nice for beginners ... by Durandal64 · · Score: 4, Insightful

    But honestly, you never know how much you hate AppleScript until you learn it. The problem with English-language syntax is that good code will be unambiguous. Writing AppleScript is one of the single worst things you can imagine. Sometimes a `the' keyword is required; other times it is not. It can be utterly infuriating. Take it from someone who has written an AppleScript Studio application that was eventually successfully deployed ... it's not fun. I did the same thing in Cocoa in about 1/6 the time.

    1. Re:Yeah it's nice for beginners ... by Anonymous Coward · · Score: 0
      I can't imagine a situation where English is better-suited than a brief, cryptic programming language. I bet the ratio of required C++ code to equivalent English spec is something like 1:100.

      English was not designed to be unambiguous, so it suxx0rs as a computer language.

    2. Re:Yeah it's nice for beginners ... by AnxiousMoFo · · Score: 1

      AppleScript is irritating.

      I think Apple's goal was probably to make a scripting language which is easy to learn for non-programmers, and arguably they did succeed.

      But once you learn the the language, the weird syntax gets really irritating. The syntax is really verbose - it can take lots of typing do relatively simple things. For anything that doesn't require actually telling an application what to do, I often give up and put whatever I'm trying to do into a Perl script and call the Perl script from the AppleScript.

      It's especially irritating if you are used to programming in other languages. AppleScript is nothing like the other languages I script or program in frequently (C++, Perl, JavaScript).

      With that in mind, it does do what I want it to do, more or less, and it is generally reasonably easy for me to figure out how to do what it is that I want to do. That's more than I can say for scripting on Windows - I find that my questions are answered more often with a Google search than actually looking through the documentation. For example, how does anyone figure out that throwing a File Open/Save dialog from a JScript or VBScript is done by the ShowOpen() method of the UserAccounts.CommonDialog object unless you find it in a Google search? I mean, UserAccounts?!

    3. Re:Yeah it's nice for beginners ... by Durandal64 · · Score: 1

      English-language issues aside, Apple really needs to just gut AppleScript and redo it from scratch. There's just entirely too much confusion as to when you should use an HFS path vs. a POSIX path, for example. Some calls say they return POSIX paths but actually return HFS paths. I worked extensively with AppleScript Studio, and even I couldn't figure out which path to use when. It was all trial-and-error.

    4. Re:Yeah it's nice for beginners ... by Bastian · · Score: 1

      I agree that the english-language syntax, while being great for beginners, is a huge hinderance when you're trying to write larger applications. I grew up with C-style languages, where you get visual clues for everything through its use of brackets, 'arrows', etc. None of that in AppleScript - just grokking the structure of the code takes a careful read-through where I'm used to being able to give it a glance because things like if-statements just physically look different from, say, a for loop.

      But really, the biggest problem that AppleScript has is that it holds your hand through the process of learning the very very basics, and then it leaves you alone to stumble through it without any additional documentation whatsoever, and it obfuscaes everything. Just keeping track of what types all the variables are is a nightmare - and I use dynamically typed variables all the time. And the error messages are totally useless. I've learned to ignore what they say and just make note of the fact that something went wrong and the spot where it happened, because the message itself either gives you not helpful info at all, or it gives you completely misleading information.

      And I'm still not sure how to access objects from my script's root namespace from within a 'tell' block except by telling my script to do it - which is a horrible kludge since the entire script is broken as soon as someone renames it.

  18. Re:Ummm. by kurosawdust · · Score: 3, Funny

    I never took Marketing in college, but I'm guessing a book titled Applescript: The Unnecessary Manual would sell even fewer copies.

  19. Python by Anonymous Coward · · Score: 2, Insightful

    I'd much prefer to use Python to script my Mac applications. Apple has done a good job of integrating Python into the Mac OS X system and made it possible to build Cocoa applications with it, but unfortunately the same cannot be said for Python's integration into the messaging/windowing system.

    The last time I attempted to write a Python script to interact with iPhoto, I ended up downloading about eight or nine seperate components, and it ended up not working due to an incompatibility with Panther (I think).

    It would be nice to see Python treated as a first-class scripting language under Mac OS X, with the same capabilities as AppleScript. About the only thing I like about Windows is that Windows Scripting Host lets you use pretty much any language (VBScript, JScript, ActiveState PerlScript, etc) to interact with objects from other languages and the system through COM (or whatever the hell Microsoft calls it this week).

    1. Re:Python by bar-agent · · Score: 1
      You can write scripts that make use of AppleScript support in:

      --
      i'd hit it so hard, if you pulled me out you'd be the king of britain [bash.org]
  20. Re:Longest summary ever? by l4m3z0r · · Score: 1
    Admit what you really want, a reprint of the marketing babble from the inside of the dust cover or the back of the book.

    And admit why you want it, because you are too lazy to read a thorough review.

  21. Wow by Infonaut · · Score: 1
    I don't know if I've ever seen a book review get bashed for being *too* thorough.

    "Sorry, Mary. You weren't superficial enough in your review. I was looking for the soundbite version, and I didn't want to use that silly scrolling thing on the side of my browser to skip to the end. You suck!"

    --
    Read the EFF's Fair Use FAQ
  22. Re:Ummm. by inkswamp · · Score: 4, Insightful
    Most people don't use Macs.

    Wrong. True, Apple has a smaller market share, but that's when you look at the whole computing market. In the home market (where Applescript was intended to be used, btw), the percentage of users is higher.

    Most Mac users don't use AppleScript.

    Wrong. Most Mac users don't program Applescript. There are lots of Applescripts out there that can be downloaded and used as-is. (Apple supplies a bunch of their own with the default OS X install.) I know lots of people who have used Applescript without knowing a thing about it. Also, Applescript was designed to be a programming language for non-programmers. I've known people who have figured out how to get things done with Applescripts without knowing much about how to use it. There isn't a huge learning curve involved for very basic stuff. In fact, there is a "record" button on the Applescript compiler interface that will write out a script from actions you're doing.

    Also, you might want to check out the future of Applescripting which is going to make non-programmer usage a lot easier.

    Most of those who use it don't really need a manual.

    Wrong. Despite its power, Applescript is woefully underdocumented. This is because Applescript has been on the chopping block more than once. It was supposed to have been tossed out with the advent of OS X, but users (did you catch that? Users) were upset by this and Apple relented to complaints and put it back in.

    There are two good manuals out there already anyway.

    Hey, you got something right.

    --
    --Rick "If it isn't broken, take it apart and find out why."
  23. "for the intermediate-to-advanced scripter" by xtermin8 · · Score: 1
    "AppleScript: The Definitive Guide (O'Reilly) for the intermediate-to-advanced scripter and Hanaan Rosenthal's reference-type manual"
    There's no other good beginners manual to start learning Applescript. Perhaps the idea is to get more people using it? Just a thought.
  24. danny goodman by Anonymous Coward · · Score: 0

    http://www.spiderworks.com/books/ashandbook.php

  25. There really is a difference by Anonymous Coward · · Score: 0

    For Safari and Firefox, which are what everyone uses anyway, I think it's going to be a while before any serious problems crop up.

    Security problems *have* been found in these programs. They've also been fixed without Apple or the Firefox group trying to save face. They just released the patch when they could.

    Internet Explorer is a browser which was a) developed in a race with Netscape, b) developmentally discontinued at the end of the race, and c) hooked into every part of the operating system.

    None of these things apply to the most popular Mac browsers. The Finder isn't based on Safari. Apple isn't trying to put other broswer makers out of business by adding features as fast as possible. Safari is still very much in active development.

    Microsoft has so completely stopped developing IE that it offers a toolbar to fix some of the glaring problems with the browser. It developed a whole separate program to fix its own program, rather than just updating the code. That's hardcore ductape.

    So yes. There probably will be vulnerabilities on the Mac. The question is whether it will be so full of thousands of vulnerabilities that you can plug a brand-new install into the net and have the machine completely crippled within twenty minutes. It isn't likely, because Apple isn't really competing with anybody but itself.

  26. One way of thinking about AppleScript by realinvalidname · · Score: 1

    Someone at MacHack/ADHOC 2004 yelled out that AppleScript is "the world's only read-only computer language"

    Then someone replied that perl is the only write-only language.

    --realinvalidname
    1. Re:One way of thinking about AppleScript by X-Nc · · Score: 1
      > Then someone replied that perl is the only write-only language.

      No, that would be forth. Makes perl look like "See Spot Run."

      --
      --
      If I actually could spell I'd have spelled it right in the first place.
    2. Re:One way of thinking about AppleScript by Anonymous Coward · · Score: 0

      APL makes Forth look about as readable as Forth does perl.

  27. Re:Ummm. by cyngus · · Score: 1

    However, people who use AppleScript tend to use it a lot. Once you discover how much you can do with it, you start to see all sorts of places that its useful.

  28. I have one question to those proficient in AS by melted · · Score: 1

    Is it possible to use something else to drive AppleScript-enabled apps? Say, Javascript or Python? For some reason AppleScript just looks foreign to me, so I'd like to use the languages that I already know. Windows supports this, Mac, it seems, does not. I'd be glad to be wrong.

    1. Re:I have one question to those proficient in AS by teridon · · Score: 2, Informative
      You must be psychic. Applescript is an implementation of the Open Scripting Architecture (OSA) API.

      There's a scripting component for Python called OSA Python, and one for Javascript called Javascript OSA.

      Frontier's UserTalk language is another implementation.

      --
      I hold it, that a little rebellion, now and then, is a good thing. -- Thomas Jefferson
  29. AppleScript is worth checking out by pr0t0 · · Score: 1

    As a graphic designer, I've always found AppleScript kind of neat, but never really found anything that applied to me or my work that did anything more than save a click or two.

    I took another look at it about a year ago. After some very short trial and error, I wrote a script that provides mail merge capability to Adobe's InDesign, a program that does not have such functionality natively.

    I'm currently working on another script that will go through an Address Book subfolder and email a PDF newsletter to those contacts that have an email address, or print an addressed newsletter to those contacts with only a physical mail address.

    It's fun stuff!

    --
    I'm sorry, but your opinion seems to be wrong.
  30. heh by Scudsucker · · Score: 1

    but my two books on Debian GNU/Linux are now rather dated in areas.

    You aren't by any chance talking about O'Reilly's "Running Debian GNU Linux", are you? I bought the second edition a couple of years ago, and the nuts and bolts stuff was great, and most of it was still very usefull. However, it was somewhat amusing to read how 16 megs was a *lot* of memory, and how OS2/Warp was gaining in populatrity.

    Of course, just a couple weeks after I bought it (and spilled Dew on part of the cover) they came out with the 3rd edition. Poo.

  31. Yes, requires a password for serious damage by Blamemyparents · · Score: 4, Informative

    Applescripts don't have any better access privledges than any other OS X program. In order to seriously damage the system, you need the admin password for access to system folders. Unix kids should note that this is OSX's policy of 'sudo everything:' let the user do as they please, but if they're going somewhere they might not want to, get passwordy real fast. Even the 'administrator' account is not truly an administrator (though he can do a lot more than a 'normal user'), the root account is actually disabled on OS X (though it can be re-enabled with little work). OS X Server, on the other hand, tries to log you in as root by default, taking the fair guess that it's dealing with someone significantly wiser with the system.

    1. Re:Yes, requires a password for serious damage by mosschops · · Score: 1

      the root account is actually disabled on OS X (though it can be re-enabled with little work).

      As a newbie OS X user, I found myself using sudo su - which is probably a bit naughty but does the job nicely :-)

  32. My Favorite Applescript by Sophrosyne · · Score: 2, Informative

    Used in conjunction with the Mail.app Rule: "if message is junk mail run applescript:"
    (* Bounce Mail Messages AppleScript Copyright © 2004 Michael Brewer Brewing Designs - http://www.brewingdesigns.com/ *)
    using terms from application "Mail" on perform mail action with messages theMessages for rule theRule tell application "Mail" repeat with eachMessage in theMessages bounce eachMessage (* Mail automatically deletes bounced messages in the GUI, but not in AppleScript, so we... *) delete eachMessage end repeat end tell end perform mail action with messages end using terms from
    Quickly bouncing your junk is the key to getting rid of it

    1. Re:My Favorite Applescript by Matts · · Score: 1

      No, this is the key to pissing people off who never sent you those mails in the first place. You realise these mails go back to forged senders when you bounce them, not the spammers, right?

      --

      Matt. Want XML + Apache + Stylesheets? Get AxKit.
  33. I might buy this... by DaedalusLogic · · Score: 2, Interesting

    I started playing around with AppleScript the other day and realized how simple it is to use it with xCode to create Cocoa GUI apps for Mac... I've already written a couple tools to run some command line tools for clients who are GUI centric.

    The only complaint I have is that for a programmer AppleScript looks horrible when you first start working with it... The "Plain English" format of do and tell and "set x to y" seems a little laborious at first when you're used to x = y;

    But that's why I'm buying the book...

  34. Normal Spacing: by Sophrosyne · · Score: 2, Informative

    (*
    Bounce Mail Messages AppleScript
    Copyright © 2004 Michael Brewer
    Brewing Designs - http://www.brewingdesigns.com/
    *)
    using terms from application "Mail"
    on perform mail action with messages theMessages for rule
    theRule
    tell application "Mail"
    repeat with eachMessage in theMessages
    bounce eachMessage
    (* Mail automatically deletes bounced messages in the GUI,
    but not in AppleScript, so we... *)
    delete eachMessage
    end repeat
    end tell
    end perform mail action with messages
    end using terms from

    1. Re:Normal Spacing: by worldboy · · Score: 1

      Thanks for the spacing but my version 1.9 Script Editor on Jaguar won't compile this beyond "mail action".

      Any help anyone? I looked in the dictionary for "Mail.app" only to not find the word mail defined.

  35. Apple's development manuals by takev · · Score: 1

    I've an apple for about a year, and have been programming on it. It is very fun. However I can't seem to wrap my mind around their development manuals.

    I guess I'm completely used to reading man-pages, and it probably has something to do with, me, being dyslectic.

    Anyway I found that some of their header files, such as for their CoreAudio API is documented very clearly. After trying to read the manuals for weeks, I could read the documentation that was left their by a programmer in one go, and finally understand why they did what they did (the API's themself are also pretty foreign).

    And the CoreAudio API development manual is not the only one I have problems with, neither can I understand the whole QuickTime API. So I am left wondering, who is writing these development manuals. And am I the only one with the problem reading these manuals.

    1. Re:Apple's development manuals by wootest · · Score: 1

      The Carbon (C?) manuals seem to be kind of daft with only lots of procedural listing. Look at any Cocoa class page and you'll find it's a little more exhaustive. They also go through a lot of trouble to seperate the "theory" or "anatomy of" parts from the actual "this method/function does this and this constant means that" parts, but once you find the right links it's smooth sailing more often than not.

    2. Re:Apple's development manuals by Ilan+Volow · · Score: 2, Insightful

      I feel your pain, brother.

      CoreAudio and the Quicktime are quite possibly the two most worst-documented sets of Apple technologies out there. I don't understand how a company that builds nearly its entire bottom line on being a multimedia powerhouse can afford to make development of multimedia applications so problematic for some many people. If you want to write a simple application that records audio or lets you playback video in a custom way, you are so totally screwed.

      You just don't know how bad it is until you're up at 3AM at your wits' end looking at a PDF of a 1997 edition of "Inside Macintosh" where all the sample code is in pascal.

      --
      Ergonomica Auctorita Illico!
  36. I've seen some good things so far. by DaedalusLogic · · Score: 1

    One thing I did read last night is that you can specify to run applications as root in your AppleScript. If the password isn't supplied in the script it automatically give you the dialog box...

    Otherwise expect the operation run with whatever permissions the user which executed the script has.

  37. Let me explain by lokedhs · · Score: 5, Interesting
    Your post was modded +2 insightful by the time I wrote this. I sincerely hope it gets modded up higher.

    I have been writing some AppleScript, and it's definately one of the few "read only" languages out there. There are languages which are "read write", such as Java which are both easy to read and reasy to write. Then there are languages such as Perl (or why not TECO) which are "write only", i.e. very hard to read. However, as I mentioned, AppleScript is one of the very few "read only" languages.

    There are quite horrible subtle details that you have to pay attention to. Things like wether your list of files is actually a list of files or a list of file names. The automatic conversion makes the difference irrelevant most of the time, except when things just break and you have no idea what you did wrong.

    How about some examples. Here's the command to set the background colour of the topmost terminal window to green:

    tell application "Terminal" to set background color of the first window to "green"
    In comparison, the Java version of the above code would look something like this:
    terminal.getWindows().get(0).setBackground("green" );
    The above assumes that .getWindows() returns a List of windows, and like all lists, .get(0) returns its first element.

    AppleScript is object oriented, and as you can see, the "of" keyword behaves like the "." operator in Java, except that the arguments are swapped. The "the" keyword is always ignored, and plural words are lists (for example, the "windows" member of the Terminal application class. "first window" (i.e. "first" followed by the singular form of the list member) returns the first element in that list. Simple, right?

    It gets worse. Here's a line from a script I wrote (although I believe this particular line was copy-pasted from some others script). It sets a variable itunesRunning to true if iTunes is running:

    set itunesRunning to ((application processes whose name is equal to "iTunes") count) is greater than 0
    I'll leave it as an excersice to the reader to figure out exactly why you have to write it like that.

    The problem is that you constantly have to look in the manual to figure out exactly how you are supposed to pass your command arguments. Suppose you have a command "send message" that sends a message to a user on IRC. Now, how do I figure out how to pass the user name and the message to send as arguments? Depending on the developer it might be:

    send message to user "jim" message text "hello, how are you"
    Or, it could be:
    send message to channel member whose nick is "jim" with text "hello, how do you feel this time?"
    Don't take me wrong, I really like AppleScript. I just wished the syntax was better.
    1. Re:Let me explain by Graff · · Score: 2, Interesting
      It gets worse. Here's a line from a script I wrote (although I believe this particular line was copy-pasted from some others script). It sets a variable itunesRunning to true if iTunes is running:
      set itunesRunning to ((application processes whose name is equal to "iTunes") count) is greater than 0

      Honestly the way you formatted the statement is what is confusing, you could also have done:
      set itunesRunning to false
      if (count of (application processes whose name is "iTunes")) is greater than 0 then set itunesRunning to true
      This better follows natural English without sacrificing any functionality and that is one of the major goals of Applescript. It's pretty simple to read through a properly formatted Applescript because it reads fairly close to English. Yes Applescript is still a scripting language so it has its quirks but overall it is very easy to learn and master. It is well-worth trying out for those quick "I want to add up the first 100 numbers which have a 3 as one of their digits" kind of problems.*
    2. Re:Let me explain by lokedhs · · Score: 3, Informative
      But that was my point exactly. There are a 100 different ways to write something, and getting it right can be frustratingly difficult. However, once it's written it's very easy to read.

      In my opinion, that is the completely opposite compared to what you want from a quick one-shot scripting language. Those should be easy to write and it really doesn't matter if it's hard to read or not. Perl and TECO are good examples of this.

    3. Re:Let me explain by Anonymous Coward · · Score: 0

      Your post was modded +5 Interesting by the time I wrote this. I sincerely hope it gets modded up higher.

    4. Re:Let me explain by Anonymous Coward · · Score: 0
      AppleScript is object oriented, and as you can see, the "of" keyword behaves like the "." operator in Java, except that the arguments are swapped. The "the" keyword is always ignored, and plural words are lists (for example, the "windows" member of the Terminal application class. "first window" (i.e. "first" followed by the singular form of the list member) returns the first element in that list.

      Apple event-based IAC is actually based on procedural RPC+relational queries, _not_ a conventional OO API as is commonly misperceived. You're dealing with attributes, one-to-one and one-to-many relationships, not getters, setters and lists.

      The "background color of the first window" phrase is actually a simple relational query, somewhat akin to XPath or OPath, that identifies zero or more objects within the application's Apple Event Object Model (an abstract object model representing some or all of the AE server application's data structures to client apps). That query is then sent to the application as one of the arguments to the 'set' message, and it's left to the AEOM to resolve that query and perform the relevant operations upon the Model object(s) identified.

      This is much more powerful stuff than your Java comparison suggests, e.g. try sending events like:
      tell application "Terminal" to set background color of every window to "green"

      tell application "TextEdit" to delete (every paragraph of every document where it = "\n")

      tell application "Address Book" to get name of every person whose value of every email contains "someones@email.org"
      to see what I mean.

      has
  38. Danny Goodman's Updated AppleScript eBook: $14.95 by Anonymous Coward · · Score: 1, Informative

    http://www.spiderworks.com/books/ashandbook.php

    Great book, PDF, and only $14.95, online immediately.

    Sample:

    http://www.spiderworks.com/samples/AppleScriptHa nd book_Preview.pdf

    Go SpiderWorks!

  39. Silly People by corblix · · Score: 1
    This series focuses on computer products that have been released without adequate printed manuals

    How pointless. I've never run across any products with that problem.

    </sarcasm>

  40. Don't forget Xcode! by myov · · Score: 2, Informative

    Xcode now lets you create a standard GUI with the regular tools (InterfaceBuilder). You would never know it's an Applescript unless you're looking around in the compiled package. I put together a quick app for a client to script InDesign and you would never know it was Applescript.

    Applescript is about the closest I've seen to ARexx on the Amiga., and that language could do anything. Just about every app shipped had some sort of arexx functionality. The parse command was the easiest way I've ever seen to separate out a string. I remember hearing people who would have a single script dial in to CompuServe, navigate to stock quotes, grab and parse teh info, paste it in a spread sheet, build a chart, export the chart into another app, etc. I could use one app as a front end and use arexx to hit any number of back ends.

    --
    I use Macs to up my productivity, so up yours Microsoft!
    1. Re:Don't forget Xcode! by Anonymous Coward · · Score: 0

      I could use one app as a front end and use arexx to hit any number of back ends.

      If you hit my back end, I'll cut off your balls.

  41. will AppleScript change a lot in Tiger? by dankelley · · Score: 1
    Tiger is due out in a few months, so this book would be a bad buy if AppleScript changes a lot in Tiger.

    Like probably everyone reading /. I've made lots of bad purchases of computing books. I don't mind it if I have to chuck the book after a couple of years, but a couple of months...

    1. Re:will AppleScript change a lot in Tiger? by desertfish · · Score: 1

      O'Reilly to the rescue:

      http://safari.oreilly.com

      Keep an electronic bookshelf of any 5 titles for $9.99 a month. (Though I didn't check to see if this title is available. Most printed titles seem to be.)

  42. Cocoa from Applescript by bonch · · Score: 1

    You can even access the Cocoa API via Applescript and create an actual app with it. It's a great little tool. Looking forward to Automator to speed things up for newbies.

  43. Applescript for graphic artists by MyDixieWrecked · · Score: 3, Interesting

    I work as a production artist in a Flag shop and at a screenprinter and find applescript to save sometimes up to 100 mouseclicks in a single task.

    I've got one script that iterates through an illustrator file and creates a list of spot colors that are used in a file. (illustrator 10/CS is fully scriptable... 9 might even be, too).

    I wrote another script that exports my illustrator files to a jpeg, opens it in photoshop, crops it, resizes it, and emails it to my customer for a proof (we don't do pdf proofs since clients could use them for production).

    Another script for when we outsource our files that dupes them, opens them, converts fonts to outlines, waits for me to doublecheck that everything's ok, then when I click OK, closes, and iterates through all the files. Then, when it's done, asks which company I'm sending to, figures out if the file is small enough to email, and if so, stuffs and emails the file to the correct email address with a list of included files, types, and sizes, or if too large to email, either stuffs and FTPs (using transmit) or launches toast, creates a new CD, and ejects the CD Tray waiting to burn.

    I've also written several scripts for creating job folders and for general file management and preflighting (opening files in photoshop and printing with info about size, resolution, file format and color mode).

    There's a very good book on Illustrator 10 applescripting and VBA scripting on amazon that got me started with scripting for illustrator, although CS works differently than 10 and requires a rewrite of the scripts.

    --



    ...spike
    Ewwwwww, coconut...
    1. Re:Applescript for graphic artists by tliet · · Score: 1

      What I haven't seen here yet, is the ability of Mac OS X to have scripts attached to folders. This is so incredibly powerful it's not funny anymore.

      For example, one can set up an OS X Server with shared folders that'll e-mail stuff to different receipients depending on the folder. Or zip and archive everything sorted by client.

    2. Re:Applescript for graphic artists by MyDixieWrecked · · Score: 1

      yeah, they really need to bring back folder actions... I didn't really use them too much when they were around until right before I switched to OSX for work, so I never really got to experience their full potential.

      Hey, at least they brought back labels, right? ;)

      --



      ...spike
      Ewwwwww, coconut...
    3. Re:Applescript for graphic artists by Xyde · · Score: 1

      Umm, I think they've been back since 10.2ish. I have the options "Disable Folder actions" "Configure Folder actions..." and "Attach a folder action..." in my OS X 10.3.7 when I right click on one... Where are you looking?

    4. Re:Applescript for graphic artists by MyDixieWrecked · · Score: 1

      oh wow, yer right!

      holy crap.

      I actually hadn't looked. I just assumed, since I haven't used them and I remember that a previous version of OSX had been lacking them.

      hmmmmm.... now I've gotta implement them....

      if only they'd bring back popup windows... *sigh*

      --



      ...spike
      Ewwwwww, coconut...
  44. Thanks so much! by melted · · Score: 1

    Man, I've been struggling with AS like you wouldn't believe.

  45. Can some one explain why AS is so slow by philge · · Score: 1

    I have writen the same program in AS studio then Realbasic and finally in Cocoa and saw at least a magnitude increase in performance each time and almost a magnitude increase in time taken to write each program. I am still learning to write cocoa so it fairly reasonable to take longer to write.
    But I am curious as to whether there is a proven inverse relationship between ease of programming and execution speed. It seems that the faster a language the harder it is to program, must this be so

    1. Re:Can some one explain why AS is so slow by Ilan+Volow · · Score: 1

      "Humankind cannot gain anything without first giving something in return. To obtain, something of equal value must be lost. That is Alchemy's first law of Equivalent Exchange."

      --
      Ergonomica Auctorita Illico!
  46. Re:Ummm. by Golias · · Score: 1

    Good Lord, it's like walking on egg shells with you people.

    I'm not saying AppleScript is bad or Macs are bad. I'm saying that we Mac users are 5% of computer users at best, that most of us never utilize AppleSript (I tend to do a lot of my scripting with Perl... YMMV), and that AppleScript is such an amazingly easy scripting language that anybody capable enough to learn a scripting language can pick up AppleScript just by skimming web sites on the subject and/or stealing code from other scripts.

    Most people don't use Macs.

    Wrong. True, Apple has a smaller market share, but that's when you look at the whole computing market. In the home market (where Applescript was intended to be used, btw), the percentage of users is higher.


    Holy crap, you gotta be kidding me.

    "Most people don't use Mac's" is a true statement. I didn't say "only four in 100 use Macs." I said "most don't."

    As in, "less than half of computer users are Mac users."

    You would have to be a complete idiot to disagree with that basic fact.

    Sheesh!

    For the record: I'm a total Mac zealot, and recently jettisoned the last of my non-Mac systems from my home network (a Linux web server and a game PC, both made redundant by my new media-room Mac mini, which hosts my web pages and plays World of Warcraft just fine.)

    --

    Information wants to be anthropomorphized.

  47. Synax and power by Craig+Ringer · · Score: 1

    Personally, I find the syntax of AppleScript so godawful that I can barely use it. I guess that's because I'm experienced with more conventional languages, and tend to think in terms of scopes and operator precedence. I often find it very difficult to figure out what parts of an AppleScript command apply to what, when.

    On the other hand, the power of the tool is just incredible. It's the consistent, simple and flexible out-of-process scripting system every other OS would kill for. Yes, I know about Windows Scripting Host (and DCOP, but it's very limited and hardly system-wide).

    If I find myself doing more mac work again, I'll be looking at the Python AppleScript interface *very* closely.

  48. The book will not be irrelevant... by MacDork · · Score: 1

    only incomplete. Like every other major upgrade to the Mac OS, Tiger will only add 'must have' new features to AppleScript.

  49. You forgot one... by Mr.+No+Skills · · Score: 1

    ...it's probably more expensive to publish a book in 3 ring binder form than traditional paperback production.

    I believe paperpack books only cost a few bucks per unit (US$) to produce in volume. 3 ring binder plus all that manual insertion probably is more, and would take up more space for shipping.

    My guess is that it's basic economics, and we're getting what's cheapest to produce.

    --
    Sleep is for the Weak
  50. That explains it... by Anonymous Coward · · Score: 0
    Apple really needs to just gut AppleScript and redo it from scratch.

    I have to disagree here. Your problem isn't AppleScript. Your problem is AppleScript Studio. There is a huge difference. I tried Studio when it was first released. I gave up in frustration. It was simply too buggy. A broken subroutine could be 'fixed' by adding

    log "I'm breaking here"

    Needless to say, that should have zero effect on the script's execution, but it made all the difference in the world in one case. In others, I had to wire things up in Interface Builder in a very specific, mystical order. Check off three check boxes in one case, broken studio app. Check off the *same three check boxes* in reverse order, everything is peachy. Then there's the fact that there is no reasonable way to pass data and objects between multiple script files. It's off limits. Every once in a while I return to it to try something new, but... while Studio has made some progress, I still find it quite useless for anything marginally complex.

    AppleScript itself on the other hand is quite nice. Just pop open Script Editor and give it a whirl. The resulting script's interface might not be as purty, but it works rather well. In short, AppleScript sucks for application development, but that really isn't what AppleScript was meant to do. It is a scripting language. When it comes to automating applications, it is a truly wonderful technology. I find the biggest limitations of the language to be the memory usage (scripts that need lots of memory start to magically break) and its single threaded-ness.

  51. Re:Ummm. by drc1 · · Score: 1

    Actually there are a number of useful online resources http://www.apple.com/applescript/developers/ http://www.apple.com/applescript/studio/ http://www.macscripter.net/ and several very helpful lists at http://lists.apple.com/archives I've used Applescript Studio to build a couple of applications very quickly.

  52. Re:Ummm. by Anonymous Coward · · Score: 0

    a-ahem.
    Although Automator works in the same niche as AppleScript and integrates nicely with it, it's something completely separate (i.e. an app could provide Automator support but no AS scripting dictionary).

  53. Re:Ummm. by Golias · · Score: 1

    That was kind of my point.

    Securing XP is something that lots of people need to do, and requires vast amounts of arcane knowledge, hence a book which explained it would make a great Christmas gift for the poor saps who need it.

    On the other hand, if such a volume was sufficiently expensive, maybe it would make more sense to just give away Mac minis.

    --

    Information wants to be anthropomorphized.

  54. Re: Applescript and the GUI by FirienFirien · · Score: 2, Interesting

    A useful little thing that was in beta for a while (and seems to have gone mainstream very quietly) is at Apple's GUI scripting page - As might be expected, it's a bit unweildy (check out the lovely example on page 3) and a bit pitfally to write, but when it's done right it works like a dream. You can script Powerpoint actions, for once. Hooray!

    --
    Browsing with +2 to insightful posts and a higher threshold makes the average post seen seem a lot more ingenious
  55. Pfft... Karma... who cares by Golias · · Score: 1

    repeating the entire post at "2", since it most certainly was not "Flamebait", but my actual honest opinion:

    "There are very few books on AppleScript, and certainly not many current volumes outside of Matt Neuburg's excellent AppleScript: The Definitive Guide (O'Reilly) for the intermediate-to-advanced scripter, and Hanaan Rosenthal's reference-type manual, Applescript: A Comprehensive Guide to Scripting and Automation on Mac OS X (Friends of Ed)."

    So, this relatively obscure yet incredibly easy scripting language which only runs on one platform which is only used by a small percentage of computer users out there had only two complete, up-to-date, and comprehensive volumes of documentation, and therefore the world was crying out for the publication of a "missing manual."

    Uh-huh.

    Let's go over this again:

    Most people don't use Macs.
    Most Mac users don't use AppleScript.
    Most of those who use it don't really need a manual.
    There are two good manuals out there already anyway.

    Wow. This thing has "best seller" written all over it.

    Mac manuals are not "missing." They are "not needed."

    Let me know when "Windows XP Security Administration: The Missing Manual" gets published. I'll buy twenty copies and have my Christmas shopping for next year done (for my PC-owning friends and relatives, anyway.)

    --

    Information wants to be anthropomorphized.

  56. Applescript Jihad by Anonymous Coward · · Score: 0

    Yeah, but he got you on mac-users utilizing Applescripts without neccessarily programming with it! I was going to point this out but decided the effort to post an lengthy explanation wasn't worthwhile. Maybe you ought to buy the book and check it out for yourself.

  57. Re:Danny Goodman's Updated AppleScript eBook: $14. by vtxplant · · Score: 1

    Thanks for the tip!