Linked by Todd Nathan on Wed 16th Feb 2005 03:34 UTC
Mac OS X I've been coding AppleScript and AppleEvents since what feels like the beginning of time, starting with AE in 1991 and OS7. Revisiting AppleScript has been one of those processes that in 1997 and now in 2004/5 I have dreaded and embraced for various reasons.
E-mail Print r 0   · Read More · 22 Comment(s)
Order by: Score:
Yeah
by Phuqker on Wed 16th Feb 2005 04:23 UTC

I love AppleScript as much as I hate it. I hate the syntax, but man, I can do some really cool shit with it.

re: Yeah
by Bastian on Wed 16th Feb 2005 04:41 UTC

I'm amazed there hasn't been more effort by the AppleScript community put into getting Apple to replace AppleScript with some other OSA-compliant language. It seems that Apple still hasn't figured out that the power of AppleScript has nothing to do with the language and everything to do with their Open Scripting Architecture technology.
Worse yet, they seem convinced that the similarity of AppleScript to English is something that makes it easier to learn. Experience has shown me that what it really does is makes it incredibly frustrating to learn because it feels as if there is no formal syntax at all, and it is all but impossible to figure out how to phrase a statement without resorting to guess-and-check. And of course they also completely failed to sweep underlying technical issues under the carpet. Nobody is going to be able to write something even as simple as a script that loops through a set of files and shuffles them around a bit without quickly running headfirst into the distinction between a path to a file and a reference to a file. And all Apple does is make that lesson even harder by giving the programmer no good way to make a distinction between the two (through their sloppy use of terms in all explanations of the language) nor to figure out what they get back from a given function (through just straight up never actually telling you). AppleScript's approach to making scripting easy makes about as much sense as making the highways safer by dropping the speed limit but removing all the traffic signals and stop signs.

@ Bastian
by modman on Wed 16th Feb 2005 05:39 UTC

100% agree!!!

I tried learning AS to do backup... what I resorted to was Perl.

AS Feels like they threw a design engineer at the problem of a scripting language.

heck... VBS feels like that as well so I guess System designers are not language designers.

@ modman
by keath on Wed 16th Feb 2005 05:55 UTC

I agree, and prefer perl to AS as well.

I'm still looking forward to how Automator may improve AppleScript creation with it's GUI and canned solutions.

Nice book review. Thanks for that.

Automator
by Bastian on Wed 16th Feb 2005 06:27 UTC

Bah. Automator will improve things, but it's just so hard lay a fine veneer on a pile of garbage and have it stick. The moment you have to start doing something that's hard to lay out with the GUI, all the pain will come back quickly enough.

v Nothing against article, but...
by Anonymous on Wed 16th Feb 2005 06:42 UTC
re: applescript? perl?
by Usario Clave on Wed 16th Feb 2005 08:37 UTC

Hello everyone, AppleScript has been around since what, System 7?

How do you script different applications, written by different vendors, with different terminology?

The answer: you don't.

AppleScript's fundamental problem stems from the differing models and terms that the applications in question use for their objects and actions. When you enabled you app for AppleScript, you were, to an extent, exposing your internals to the world. When you wrote your dictionary, you used terms that were, well, specific to your application.

Whe you script across applications, you have to be able to figure out (to an extent) what each application called its "thing", whether that thing is a file, item, reference, whatever.

AS requires a lot of trial and error, because you're manipulating another application directly. It also has enormous power for people that know what they're doing.

Writing a backup script in applescript is like writing a graphics and print production workflow in perl. You could, but why bother? And you can't script quark, illustrator, photoshop, filemaker, etc in perl anyway.

For the joe blow yokels who read os news, perl, shell, etc are appropriate. AS is useful across specific domains - people that need to integrate applications together. For everyone else it's useless.

Exactly
by Anonymous on Wed 16th Feb 2005 10:44 UTC

There is some really cool stuff you can do with Applescript, that is non-trivial using other languages. But damn, what an ugly syntax it has, crappy error messages and lack of decent documentation.

Python (PyObjC)
by Anonymous on Wed 16th Feb 2005 12:06 UTC

Now that Python has COCOA bindings, there's no reason (for me) to code in AS.
I always think "Multi-Platform", and AS is not.
http://pyobjc.sourceforge.net/index.php

re:re: applescript? perl?
by modman on Wed 16th Feb 2005 13:06 UTC

hmmm why do a backup in AS? perhaps because you can manipulate finder with it?

what I hate is that there are not certain features to AS for the OS that it should have... don't ask me what they were, I cannot recall exactly, all I know is I hated having to find another way to do something because a simple feature was not part of the language functions.

@Python (PyObjC)
by emacs on Wed 16th Feb 2005 13:56 UTC

Really? Maybe one of these Mac Minis would be worth the plunge...

Good Book...
by fizzle on Wed 16th Feb 2005 15:18 UTC

Layout is pretty good. I'd rate it 3 out of 4 stars.

agreed.
by Richard Fillion on Wed 16th Feb 2005 15:21 UTC

When I first took a look at AppleScript when I got my Mac, I was disgusted. Worst. Syntax. Ever. I still don't like writing it, but omg is it ever powerful. I had to learn ObjC/Cocoa programming to see this.

As for Python replacing AS... I like Python just as much as the next guy, but they serve different purposes. I can't embed python straight into my ObjC application to talk to iTunes.

My only problem with Apple script
by peragrin on Wed 16th Feb 2005 16:20 UTC

is the same problem with most command line programs.

a lack of documentation.

Re: Bastian
by Lars on Wed 16th Feb 2005 16:50 UTC

Worse yet, they seem convinced that the similarity of AppleScript to English is something that makes it easier to learn.

It does make it easier to learn - in the beginning. For people who know nothing about programming an english syntax definitely lowers the fear threshold.

Of course, in the long run the syntax tends to get in the way, which is why Frontier saw the light of day.

Thoughts on Applescript
by Paul on Wed 16th Feb 2005 18:08 UTC

I've used AS off and on since the early 90's and I've done some fairly heavy stuff with it, but I never did enough for long enough to feel confident (when it refuses to work, I never know if it's my fault or theirs.)

I agree, I despise the syntax. There is a freeware Javascript plugin (the only OSA plugin that exists AFAIK); I've never gotten around to learning its object model well enough to try it. Unfortunately, AS inner workings are so poorly/skimpily documented that it looks impossible to write for it; most such things (including that JS plugin) seem to come from companies started by ex-Apple guys.

The biggest problem is uneven support: it is extremely painful to add AS to an application (Powerplant tries to help, but there is still a MAJOR learning curve and a LOT of typing.) The result is that "scriptable" apps are completely unpredictable. Apple's own Finder is notorious for providing 6 apparently valid ways to do something: 2 don't work at all (errors like "can't get the name of file "the_bloody_name_it_can't_get!""); 2 fail silently and return garbage; 2 actually work. I've done some cool things w/ the Finder, though, and it seems like it might be possible to eventually learn its dialect well enough to avoid the problems.

AS was an incredibly brilliant idea. Where people (developers and users) have put in the effort it works wonders (i.e., Quark Express.) But (yechhh) VBScript on Windows is generally easier to use and less troublesome, when supported and documented enough to even try.

Good for beginners
by Kevin Walzer on Wed 16th Feb 2005 19:23 UTC

For beginners, AppleScript is definitely useful as a "gateway" language. I learned the basics of programming logic from AS, and the basics of GUI programming by developing a few trivial apps with AppleScript Studio. The English syntax definitely lowers the fear factor for beginners, although I understand how someone from a more traditional background would find it aggravating.

I've since moved on to Tcl and Python, more robust languages for general programming.

Automator
by Grammar Cop on Wed 16th Feb 2005 19:37 UTC

automator doesn't use applescript for its scripts FYI

python
by spaceboy29 on Wed 16th Feb 2005 19:55 UTC

Would Python be better to learn than AppleScript?

Off the beaten path, but does anyone else Apple and IBM slow at boosting the speed on the 970 chip. I mean once a year is a little slow. Maybe Apple better go with Intel given the slow turn about on PowerPC upgrades for Apple.

@spaceboy29
by ComputerVision on Thu 17th Feb 2005 03:02 UTC

Here is a very good pdf about the new IBM etc. groups new PowerPC based cell processor thats been in the news. This paper gives a very good accessment of the future of the technology. I'm sure Apple will be introducing these, perhaps as soon as later this year.

http://www.mymac.com/fileupload/CellProcessor.pdf

thanks
by spaceboy29 on Thu 17th Feb 2005 03:56 UTC

oh cool, thanks!!

Re: python
by has on Sat 19th Feb 2005 20:26 UTC

spaceboy29: "Would Python be better to learn than AppleScript?"

It's a much more powerful, robust and logically consistent language, with excellent library and community support. There's plenty of good documentation and tutorials both online - e.g. [http://www.python.org] [http://www.byteofpython.info] - and in dead-tree format. If you want to learn how to program, it'll bend your head a lot less than AS will. (If you already know how to program, you probably won't want to go near AS anyway.:)

As for using Python in place of AppleScript, its application scripting support is pretty much on-par with AppleScript's: still a little rough around the edges and lacking tutorials, but getting there [http://freespace.virgin.net/hamish.sanderson/appscript.html] (self-link). Its OSA support - needed to attach scripts to applications and edit them in Script Editor - is currently limited though also improving, e.g. see [http://homepage.mac.com/philip_aker/osa/osa.html] for a promising candidate.

HTH