4

What resources would you recommend to pick up AppleScript. I come with a traditional C/C++ with Objective-C background.

I am also looking for tips on how to develop better and get faster documentation from the script editor. A sample tip would be 'lookup the sdef file of the app you want to script.

notnoop
  • 58,763
  • 21
  • 123
  • 144

9 Answers9

5

I learned from AppleScript: the Definitive Guide. The free documentation available online at that time was quite confusing and incomplete, but that book taught me everything I needed to know. I'm not sure if the docs have improved since then (2005-ish).

As for tips on getting documentation, the script editor's "Open Dictionary" command is about the only documentation you'll get for most applications.

Ryan Ballantyne
  • 4,064
  • 3
  • 26
  • 27
3

I recommend Applescript: The Definitive Guide like Ryan Ballantyne. Apple's own documentation is very good: Scripting and Automation: Applescript. I would seriously recommend reading lots of Applescript code as well, this is as important, if not more important, than reading these other resources. It is important to get a feel for what makes good and bad Applescript because there is an ocean of difference in readability between the good and the bad. You can find lots of code to read in Apple's material and at macscripter.net.

Pinochle
  • 5,515
  • 2
  • 26
  • 20
2

If you are going to be doing any, even remotely, serious development with Applescript, I highly recommend getting a copy of Script Debugger from Late Night Software.

Apple's own Script Editor and Applescript Studio (which is simple Script Editor wrapped in Xcode) offers no debugging tools, you'll rely solely on their (sometimes esoteric) error messages and your own cowboy debugging (the "log" command). Script Debugger picks up where Script Editor leaves off—proper debugging, code stepping, code completion—and also runs scripts much faster. I can learn a lot about how a an unfamilar application implements Applescript with Script Debugger because the dictionary reader will actually give the exact syntax needed to use a command in most cases.

Philip Regan
  • 5,005
  • 2
  • 25
  • 39
2

I agree with the folks above. Start with Soghoian's book. Very good. And then The Definitive Guide. Also, get on the Applescript Discussion list. Very good, with the author of the Definitive Guide being a major contributor to that.

And get ScriptDebugger 5. Absolutely necessary for serious Applescripting. I use it to automate Photoshop, Filemaker, and my Mac do to pretty complex things in managing photos and metadata for my employer.

  • One should also point out that Script Debugger has an Explorer window which does make it possible to browse at practically all data in an app while it runs. This helps a lot to figure out how to get to things. This feature alone is worth the not so low price of this excellent tool. – Thomas Tempelmann Apr 03 '16 at 21:53
1

This isn't exactly a good place to start, but the document that I found most useful was a discussion on the design of AppleScript written by one of its original designers.

It mostly talks about the evolution of AppleScript from an idea to an implementation. There's a technical part in the middle, though, that really glued a lot of things together for me. I was interested to learn that most of AppleScript's design stemmed from limitations in MacOS at the time. There's also a bit at the end reflecting on how AppleScript has fared over the years.

Thomas Tempelmann
  • 11,045
  • 8
  • 74
  • 149
Daniel Yankowsky
  • 6,956
  • 1
  • 35
  • 39
1

Another suggestion: while reading up on AppleScript, take a look at Appscript which makes the Apple Event technology underneath AppleScript available in Python, Ruby, or even Objective-C. Why? Many people find the AppleScript language itself lacking compared to more modern languages like Python or Ruby. But whichever way you choose, be prepared for a certain level of frustration. Much of the power of Apple Events and scripting comes from the richness of the data models that AppleScript-able applications can implement. Unfortunately, every AppleScript-able application has its own implementation quirks and often there is a fair amount of hunting and pecking guesswork until you find the incantation that works for a particular operation. HAS touches on some of this here.

Appscript also provides some developer tools, like ASDictionary which exports applications' terminology as plain text or HTML files and in AppleScript or appscript formats.

Community
  • 1
  • 1
Ned Deily
  • 83,389
  • 16
  • 128
  • 151
0

I'm in the middle of AppleScript 1-2-3 by Sal Soghoian who is in charge of the AppleScript program at Apple; step-by-step, good

  • 1
    This is rather a comment than an actual answer. It would be better if you provide the link to this tutorial. – akluth Oct 05 '12 at 13:04
0

I'm trying to learn as well. Currently reading http://macscripter.net/viewtopic.php?id=24729 It's really good. But the link in the post is broken, so you have to search for the next post.

And my next stop is: http://mac.appstorm.net/how-to/applescript/the-ultimate-beginners-guide-to-applescript/

Runar
  • 85
  • 1
  • 1
  • 7