[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Re: general AppleScript Rant



Continuing on the off-topic... Well, the audience for AS and MacPerl
overlaps a lot, at least, until AE scripting in MacPerl gets easy enough
to drop AS altogether. I'll try to keep it brief.

On Thu, 3 Sep 1998 17:43:08 -0500, Jefferson R. Lowrey wrote:

>>1. In trying to be like a natural language, it's got innumerable
>>   ways of stating every little thing.  Which variants are usable at a
>>   given time varies considerably.
>
>And, what
>exactly is wrong with "There's more than one way to do it"?

Because not all do indeed work. If Perl worked this way, we would be
*very* irritated. Example:

   tell application "QuarkXPress"
       tell document 1
           tell picture box 1
               tell image 1
                   set name to "box name"
               end tell
           end tell
        end tell
    end tell

This SHOULD be equivalent to:

   tell application "QuarkXPress"
       tell document 1
           tell picture box 1
               set name of image 1 to "box name"
           end tell
        end tell
    end tell

...and I'm sure you can see all variations that can be made of this :-).
Unfortunately, only one will work. In fact, most variants will NOT work.
It looks like the statements effectively send different Apple Event
sequences, and the app doesn't recognize them all.

It's up to you, the scripter, to test tens of "equivalent" code
snippets, until you find one that actually works.

Well... I find that an irritating "feature".

Another example is the text manipulation facilities, in which Perl
really excels. Two examples:

 A) Simply try to get rid of the very first character in a string of
text. The only way I could find, that works, is to convert the whole
string to a list of characters ("every character"), take the appropriate
slice, and turn the list into text again. Talk about inefficient. And,
you have to clear Applescript's text item delimiters first, or you'll
get a lot of junk inbetween. 

 B) Search through a string, for a substring. All that AS provides is
some sort of "instr" that says either "yes" or "no". No way it will tell
you WHERE it found the substring. Idem with searching through a list: AS
can tell you it found a particular item in a list, but again, not at
what position.

I better stop now. :-)

	Bart.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch