Hello list,

I am about to switch away from Applescript -- either that, or go mad.

I've been working on my first Applescript project for a month now. It involves loading a Filemaker database. I have never encountered such a difficult-to-use language before in 30 years of professional programming, and I wonder why some people swear by Applescript. I think it may be from inexperience.

Before I make a serious effort to check out MacPerl's AppleEvent library, it would benefit me greatly to read what members of this list have to say about their experiences with AScript, and specific ways in which MacPerl/AppleEvents makes life easier. I would say I'm an advanced beginner in Perl 5 at this point.

To get the ball rolling, and to give an example of something AScript does that makes it "difficult" from my point of view, here's the most recent thing to confound me:

I wanted to retrieve a set of FM records meeting certain criteria, and iterate through them. Roughly like this:

get a list of handles to records whose "Price" field is "*"
for each handle in the list {
        do something with the record the handle refers to
}

Did it even cross your mind to wonder how I would deal with a solitary record? or with no records at all? No? Good. We're on the same wavelength ;-)

I got it working fine until I tried it with criteria that located exactly ONE record. Filemaker or Applescript (not sure which) decided to return the handle as a scalar, rather than as a list containing one handle. Runtime error in the For loop.

After fixing that, I tried it with criteria that located ZERO records. Filemaker decided it could not give me a handle of something that didn't exist, and threw a different runtime error.

Here's a language that thinks (to name but one flaw) that zero or one things can't comprise a list of things.

Now Perl does that right, as does any sane language. Perl is documented, it has debugging facilities, useful error diagnostics, great string handling, comprehensible scope rules, libraries galore. Applescript is, IMO, a failed attempt at an "Englishlike" programming language (or a successful attempt, if you're cynical and learned English as a Second Language). It is littered with ambiguities, you can't predict if a given construct will compile or not, much less do what you want. Even its continuation line policy sucks. Yadda yadda yadda.

These are some qualities I need that are lacking in AScript. If these kind of things are important to you, then if you could take a moment to comment on how Perl/AppleEvents compares with Applesccript, it would be very useful.

Thank you for your help,
Chap



Reply via email to