Re: TIDs Inquiry
Re: TIDs Inquiry
- Subject: Re: TIDs Inquiry
- From: Paul Berkowitz <email@hidden>
- Date: Sun, 10 Nov 2002 15:36:30 -0800
On 11/10/02 11:38 AM, "David" <email@hidden> wrote:
>
Example a)
>
a
>
b
>
c
>
d
>
>
Example b)
>
a,b,c,d
>
>
Example a would show a 1 item list while example b would appear as a
>
four item list. Am I correct in assuming that example a *should* show
>
up as a four item list? As I mentioned earlier, if example a was pasted
>
into a variable the result would also match the behavior that I have
>
described for example b.
>
>
Sure it would be easier to simply write the file with commas but then I
>
do not learn what is wrong here and I get a file that is a pain to
>
manually modify.
You must be using the wrong delimiter. For some reason you have omitted that
not exactly unimportant information. Why is that? TextEdit, a good Cocoa
app, uses linefeeds (ASCII character 10), not return (ASCII character 13) as
delimiters.
What should work in either case is just getting 'paragraphs', but Iseem to
recall that there is a bug when the delimiter is Unicode linefeeds, which it
would be in this case. So forget that for now.
Also beware that there is a limit to the number of list items that can be
made by this method: it's approx. 4060. So if it could be more than 4000 you
need a routine that gets 4000 at a time, then concatenates the lists. Use it
from a try/error block if the regular method errors.
You can handle resetting tids differently than I do (I usually reset to {""}
and make special arrangements to do otherwise if I need to.)
on LargeTidsList(theText, tid)
local newList, a, z, done
set AppleScript's text item delimiters to {tid}
set {a, z} to {1, 4000}
set newList to {}
set done to false
repeat until done
try
set newList to newList & text items a thru z of theText
set {a, z} to {a + 4000, z + 4000}
on error -- last segment, fewer than 4000
set newList to newList & text items a thru -1 of theText
set done to true
end try
end repeat
set AppleScript's text item delimiters to {""}
return newList
end LargeTidsList
--
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.