Faulty text item delimiters
Faulty text item delimiters
- Subject: Faulty text item delimiters
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 10 Oct 2005 23:07:17 -0700
- Thread-topic: Faulty text item delimiters
I know this sounds crazy, but a user of mine has faulty text item
delimiters. He says it "only started recently". I can't reproduce the
problem here: OS 10.4.2, AS 1.10, iCal 2.0.2. The user has the same, plus
the security update 2005-008. I checked a wild guess that maybe the Security
Update had caused this, but, no: I've just applied it on my PowerBook and I
don't see the problem. Same if I switch my first language to British
English, as the user has - no problems for me.
I would appreciate if others in 10.4.2 would try the little script just
below and report back your results. If anyone sees the same odd results as
my user, maybe we can track down what causes it.
The problem arose when he tried to run a script of mine that checks the
version of iCal and won't run if it's earlier than v2.0. I narrowed it down
to this bit:
set AppleScript's text item delimiters to {"."}
tell application "iCal" to set icalVersion to version as string
set txtItems to text items of icalVersion
set AppleScript's text item delimiters to {""}
set icalVersion to text 1 thru 3 of ((txtItems as string) & "0")
{txtItems, icalVersion}
--> {{"2", "0", "2"}, "202"}
But what he gets is :
--> {{"2.0.2"}, "2.0"}
I.e. the periods in "2.0.2" are not seen as identical to the delimiter
specified by "." so the whole string "2.0.2" is the only text item! (The
next line of the script compares the iCal version result as integer to 200:
set iCalWorks to icalVersion 200
if not iCalWorks then
quit -- etc.
end if
Since in his case the integer coercion produces 2 rather than 202, the
script quits.
A few checks show that with
set AppleScript's text item delimiters to {"." as string}
he gets the same bad result. But change it to:
set AppleScript's text item delimiters to {"." as Unicode text}
tell application "iCal" to set icalVersion to version as Unicode text
and he gets
--> {{"2", "0", "2"}, "202"}
as he should. This remains true (good result) both for
set icalVersion to text 1 thru 3 of ((txtItems as string) & "0")
and for
set icalVersion to text 1 thru 3 of ((txtItems as Unicode text) & "0")
At this point I don't know whether the problem is going to occur for every
use of string text items delimiters on Unicode text, or if there's something
especially wonky about [iCal only?] version type coerced to string. Nor what
caused this.
I don't even know what to report yet to Bug Reporter. Could my user have
some sort of freak component somewhere? Any suggestions as to what he could
try short of an Archive & Install of the OS?
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden