Re: Why save text item delimiters? Philosophical question....
Re: Why save text item delimiters? Philosophical question....
- Subject: Re: Why save text item delimiters? Philosophical question....
- From: matt neuburg <email@hidden>
- Date: Tue, 17 Jun 2003 16:05:07 -0700
On Sun, 15 Jun 2003 16:09:18 -0600, David Crowe
<email@hidden> said:
>
One of the common aspects of all scripts that use the AppleScript
>
text item delimiters is that first they are saved, then set to the
>
desired value, then used, then restored.
>
>
In my mind, the first and last steps are a waste of time. If every
>
script always sets the delimiters to the desired value, then there
>
should be no need to restore them, and the code to save/restore is
>
just a waste.
I agree. The way the Apple documentation jumps up and down about this and
waves its arms about is a complete waste. There is nothing special about
text item delimiters in this regard; it's just like all the other global
AppleScript properties.
The problem, if there's a problem, is that if you set a global AS property
it remains set for the lifetime and within the context of this instance of
the AppleScript scripting component. So, for example, suppose you have two
scripts open in Script Editor. Let the first one say:
set AppleScript's pi to 3
Let the other one say
AppleScript's pi
Run the first, then the second. The result of the second is 3. What you did
in the first script affects what happens in the second, because this is a
global property belonging to AppleScript, meaning the Script Editor's
current instance of the AppleScript scripting component. Now quit the
Script Editor and start it up again, and run just the second script.
Behold, pi is once again 3.14159... and geometry is saved. Just in time,
too, because a lot of the universe was about to stop working...!
As long as you're aware of this, there really is no difficulty - exactly as
your note states. m.
--------
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.