Re: Real Simple Question
Re: Real Simple Question
- Subject: Re: Real Simple Question
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 06 Nov 2002 07:51:59 -0800
On 11/6/02 7:18 AM, "Joey Parshley" <email@hidden> wrote:
>
I am trying to learn AS and I see references to tid's. What does that mean?
>
AppleScript's text item delimiters (Test Item Delimiters). They are very
useful: you can turn lists of strings into a string using any tid (perhaps a
carriage return, or a comma, or a space) to be inserted between the
original list items. And you can use it as a search string to break up a
long string into lists, change the delimiter, and turn it back into a string
again:
set str to "I caught the fish and sent it to the friend of my cousin's."
set AppleScript's text item delimiters to {" the "}
set lst to text items of str
-- {"I caught", "fish and sent it to", "friend of my cousin's."}
set AppleScript's text item delimiters to {" a "}
set str to lst as string
--"I caught a fish and sent it to a friend of my cousin's."
set AppleScript's text item delimiters to {""}
(They are usually used to a greater purpose than in that example. ;-)) They
are "universal" to all scripts in the application running the script, for
that session, i.e. until you quit it. That is more of an issue if you are
running compiled scripts in another application - e.g. Script Editor,
TexEdit Plus, Outlook Express - than in a a script application which
finishes its "session" as soon as the script finishes. But that's why you
need to reset tids when you're done. There is some disagreement as to
whether it's all right to reset them to the default {""} as I just did
above, or whether you should first find out what they are and reset them to
that at the end. (I happen to agree with JD that unless you are returning
from a handler - subroutine - when you might well need to return to some
other tids, that setting to the default {""} is actually a good safety
measure just in case another script has forgotten to reset them. Never
mind.)
You can read the full details in the AppleScript Language Guide, available
in PDF from the Apple AppleScript website.
--
Paul Berkowitz
_______________________________________________
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.