Re: Out of Memory
Re: Out of Memory
- Subject: Re: Out of Memory
- From: "Arthur J Knapp" <email@hidden>
- Date: Tue, 13 Feb 2001 18:08:03 -0500
>
Date: Tue, 13 Feb 2001 15:54:16 +0000
>
Subject: Re: Out of Memory
>
From: "Jason W. Bruce" <email@hidden>
>
Are you building a list of strings or text items? Arthur Knapp has pointed
>
out that Applescript has an internal limit of around 4000 text items in a
>
list.
Well, I don't know who this "Knapp" character is, but here is an
old handler of mine that I haven't really looked at in a long time,
(it may not even work properly, you've been warned):
property kAutoLim : 4000
to s_textitems(str)
-- returns the text items of str, using the current tids,
-- and trapping for upper limit on AppleScript string-to-list
-- coercion, (using property kAutoLim)
set _count to count of text items in str
if _count > my kAutoLim then
-- then text items of str can "safely" be coerced
return str's text items
else
-- then we need a method to collect groups of coerced
-- strings.
-- result-variable slightly speeds this up
{} -- initialize result
repeat with x from _count to my kAutoLim by -(my kAutoLim)
-- Note: x will never be less than my kAutoLim
str's text items x thru (x - (my kAutoLim) + 1) & result
end repeat
if not (x = my kAutoLim) then
-- then _count is not divisable by my kAutoLim, so there are
-- leftover items
return str's text items 1 thru (x - (my kAutoLim)) & result
else
return result
end if
end if
end s_textitems
--
{
Arthur J Knapp, of STELLARViSIONs ;
http://www.STELLARViSIONs.com ;
mailto:email@hidden ;
how many?
zero.
are you sure?
i counted twice.
}