Re: When to use text VS text item
Re: When to use text VS text item
- Subject: Re: When to use text VS text item
- From: "J. Stewart" <email@hidden>
- Date: Sat, 6 Sep 2008 05:38:57 -0400
On 9/5/08 at 4:51 PM, Joe <email@hidden> spake thusly:
I have both seen examples and tried constructions like the following.
text 10 thru text -2
text 10 thru text item -2
While trying to explore the differences between these two
statements, I came across a lengthy discussion in the archives
concerning the differences. The discussion starts here:
http://lists.apple.com/archives/applescript-users/2002/Feb/msg01162.html
I am wondering, given that AppleScript has changed a lot since
then, if the arguments presented remain valid today in
AppleScript 2? Reading posts to this list from the last few
months suggests this may no longer be true. Almost everyone
uses the former while no one seems to use the latter.
Is this difference any longer important?
Assuming I'm not completely off base here, I've not seen either
of those constructs written as you've got them. What I have seen
is either
text from 10 thru -2 of somevar
or
text items 10 thru -2 of somevar
The first one returns a subset of text from a larger block,
starting at the 10th character position and ending with the -2nd
character position. The subset is returned as a contiguous block
not a list such as you'd get by using "characters" instead of
"text". This always returns the same text given the same initial
block of text.
The second works a bit differently as it uses Applescript's Text
Item Delimiters (tids) which are normally set to {""} but can be
set to different values multiple times within one script. What
gets returned is defined by that setting.
Given the same block of text, setting tids to {return} will give
something completely different then setting them to {", "} or
{tab} or {" "} etc.
J
--
The views expressed here do not necessarilly represent the
unanimous view of all parts of my mind.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden