Applescript 1-2-3... Still(?) a good place to start?

Not strictly speaking an Applescript question - but would appreciate some thoughts/suggestions:

I’m hoping to roll up the sleeves and delve more seriously into Applescript in the next several months.

Would Soghoian & Cheeseman’s 2009 book still be a good place to start? The value in simply jumping into some simple scripts aside - I usually prefer using manuals to familiarise myself with the underlying theory as well - will this get the ball rolling?

“Learn AppleScript The Comprehensive Guide to Scripting and Automation on Mac OS X” Third Edition by Hamish Sanderson & Hanaan Rosenthal is great. Nicely structured all the way from beginner level to some quite advanced applescript.

Also pick up a copy of Script Debugger 6. Its worth every penny in the time it will save you over using Script Editor. The object explorer is essential for exploring any program’s object model and playing around with it immediately gives you an insight into was is and is not possible with any particular program.


Just adding my two cents: I have availed myself of and used Apple’s Applescript guide for reference when needed.

While I agree that Script Debugger is a fine tool, for almost 20 years of professional scripting I have steadfastly only used Apple’s built-in Script Editor and Shift-Command-O to open an app’s dictionary, as needed.

It may be that AppleScript is a good place to start, but one or two caveats before jumping in:

  1. There is now an official Apple alternative which you could consider, in the form of JavaScript for Automation (It’s essentially standard Safari JavaScript, plus an Automation object with methods and properties which allow interaction with apps like DEVONthink)
  2. JavaScript may prove a better long-term investment of your time, in that it can also be used on the web and in iOS (Drafts, 1Writer, and, it seems Omni plans for at least OmniGraffle, possibly more), whereas AppleScript is a one-pond creature.
  3. The AppleScript books like Sanderson & Rosenthal are by now getting just a little long in the tooth (the section on AsObjC, for example, is now redundant, as JS for Automation and AppleScript can now use ObjC functions directly).

My personal point four, despite having had a lot of fun with AS for many years in the past, is that JavaScript has:
a) much better built in libraries for simple things like sorting, shifting case, using Regexes and URLs,
b) a much easier syntax for records (you can ask a JS record what fields it has got, and it will tell you, whereas an AS record will just panic and throw an error)
c) constructs like map, filter, and ‘reduce’ which means that you seldom have to mess with setting up loops, and fiddling with accidental bugs at their borders.
d) With JS for Automation, you get use of the excellent Safari JS debugger for free.

On the other hand, if you do start with AS, and find that scripting proves useful and interesting, then learning JS later would not be hard.

JavaScript generally has a huge number of online and printed learning resources, aimed at every level. The best detailed documentation is here:

The details of the Automation library object can be explored at:



You can find some comparisons of AppleScript with JavaScript on

See, for example:

I don’t disagree with houthakker’s comments, but for a noob, I think the terseness of Javascript is more daunting. AppleScript is a very friendly (and still VERY powerful language) that allows someone to have quick successes easily. Also, some of the limitations of AppleScript force you to think around corners instead of having prebuilt answers. This requires you to be more creative in your approach and make the language do things people say can’t be done. :smiley:

That being said, shell scripting isn’t that friendly but it’s Oh So Powerful! A bit more dangerous? Yep, but handled with respect and caution, it is a great way to extend your scripting chops and get more comfortable with more terse languages.

Javascript (and JXA) and nice extensions to your toolbox, and definitely offer some built-in tools you won’t find otherwise. If you’re inclined to just go for it, go for it. If not, then keep JS and JXA on your radar for ways to increase your capabilities.

Two cents.

Could be.
Here are AS and JS versions of swapping rows ⇄ columns:


-- transpose :: [[a]] -> [[a]]
on transpose(xs)
    set lstTrans to {}
    repeat with iCol from 1 to length of item 1 of xs
        set lstCol to {}
        repeat with iRow from 1 to length of xs
            set end of lstCol to item iCol of item iRow of xs
        end repeat
        set end of lstTrans to lstCol
    end repeat
    return lstTrans
end transpose

on run
    -- TEST
    transpose([[1, 2], [3, 4], [5, 6]])
    --> {{1, 3, 5}, {2, 4, 6}}
end run

Sierra JavaScript:

(() => {
    // transpose :: [[a]] -> [[a]]
    let transpose = xs =>
        xs[0].map((_, iCol) => => row[iCol]));

    // TEST
    return transpose([
        [1, 2],
        [3, 4],
        [5, 6]
    // --> [[1, 3, 5], [2, 4, 6]]

Other variants, in both languages, on this page: … ppleScript

Appreciate the feedback and thoughts. Some things to mull over - which is always good/welcomed!

Apple recently eliminated the position of Product Manager for Automation Technologies and Sal Soghoian, who held that position and ran Apple’s Automator, AppleScript, JXA product lines for nearly 20 years, left Apple:

Perhaps not a good sign? We’ll have to wait and see.

Sol’s website, MacOSX Automation is one of the best.