Re: coercing a list
Re: coercing a list
- Subject: Re: coercing a list
- From: Ric Phillips <email@hidden>
- Date: Thu, 30 Aug 2001 09:32:29 +1000
>
>> It yields "abc" on my system. Have you been modifying text item
>
>> delimiters?
>
>
>
> Yes, sorry, I didn't realise they stayed changed from one execution of a
>
> test program to another.
>
>
They're systemic within the application that invoked the change. If you
>
change them in an applet, they stay changed only within that applet, and
>
only until the applet quits, for example. If you change them in a script
>
run from script editor, they stay changed until script editor quits, so
>
running another script will use the changed TIDs.
>
>
Of course, we're referring to the last change made.
>
Where ever I use TIDs I put (or load) the following script object into my
code, which makes them easier to use...less typing, one command to change
them, one command to restore, minimal error checking to catch type errors
when using a variable.
script TID
property savedTID : ""
to setTID to c with saveOld
if (class of c is string) then
if saveOld then
set savedTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to c
else
set AppleScript's text item delimiters to c
end if
else
error "setTID parameter of TID must be a string"
end if
end setTID
to restoreTID()
set AppleScript's text item delimiters to savedTID
end restoreTID
end script
Ric Phillips
Computer Laboratory Support Officer
Faculty of Humanities and Social Sciences
La Trobe University
9479 2792