So called "programming" with AppleScript

merlyn on 2003-01-26T17:15:07

I just finished ranting for about an email page's worth on the AppleScript developers mailing list about the frustrations that I have every time I attack an AS problem, even being a 30-year veteran programmer.

In formulating my thoughts, three major points came out:

  • The datatypes in AS are complicated, especially around "naming something on disk", because there's a lot of legacy that has to be included and supported. And then they threw Unicode on top of that.
  • Much of the higher-level filtering and list wrangling for domain-level data must be implemented in the application space by including the proper programming or libraries. If a particular application leaves it out, or uses older libraries, a pattern I learned with one data set won't work with another, simply because the application doesn't include support for that filtering. The workaround is to first try it, and if it fails, bring the entire data over to the applescript runner app instead of leaving it in the application space, and then do the filtering there. Ugh.
  • Documentation for AS sucks. There's legacy "master" documentation for an older version of AS, but then you have to jump around reading release notes, and outdated Finder AS docs, and releases notes patched to that. There's no one central doc or docset that tells me how to program AS on OSX 10.2.2. At all.
So, AS is fine, except for data and algorithms and documentation. Ooops, what's left? {grin}


Book?

darobin on 2003-01-27T12:09:08

IIRC ORA France is working on an as yet unpublished title on AS that is supposed to fill in the kind of documentation gap you are referring to. It might be worth following what comes of it, the mothership does occasionally translate books from the "little ones" into English.

referring to files

hayne on 2003-01-28T02:19:44

I also found the file reference syntax very confusing and irritating. But then I discovered the POSIX keyword. With it, I can refer to files by their UNIX path - the way I am familiar with.
E.g. (calling AppleScript from a shell script):
echo "set ofile to POSIX file \"$audiofile\"
          say \"$message\" saving to ofile"
  | /usr/bin/osascript

Mac::Glue

pudge on 2003-01-31T16:17:40

This is why I wrote Mac::Glue. :-) It still isn't perfect ... you still have to deal with the shortcomings in the respective applications, of course, and other things inherent to Apple events, and AppleScript apart from its syntax. But at least you can avoid most of the syntax.

Coming soong to Mac OS X ... maybe next couple of months.

Uselessness of AS

speters on 2003-02-26T19:46:33

But...but...but...it can do SOAP and look up stock prices. That's useful for programmers, isn't it. I've worked with Mac's on and off for over 12 years and have still been waiting to find a good reason to use AS. Also, I agree, finding a good source of documentation is painful, especially on the Apple site. Digging for documentation usually tells me I'm using the wrong tool.