Re: stack overflow ???
Re: stack overflow ???
- Subject: Re: stack overflow ???
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 11 Dec 2002 08:14:31 -0800
On 12/11/02 6:02 AM, "Monsoft" <email@hidden> wrote:
>
I have a problem with adapting a script from MacOS 9 to MacOS 10.2.2
>
This script was running without problems in MacOS 9 but I get an
>
AppleScript error in MacOS 10:
>
stack overflow
>
-2706 error
>
I have the same error when running it using Script Debugger 3.05 Carbon.
>
Is there a memory allocation problem? How to solve that?
Is there any line in the script that makes a list by getting paragraphs, or
words or text items (i.e. using delimiters) from text? If the resulting list
would have more than about 4060 items you get the "stack overflow" error -
in all versions of AppleScript. Possibly, you're just running the script on
a larger text than usual this time. You need a routine such as:
try
set theLines to paragraphs of theText
on error
set theLines to my LargeTidsList(theText, return)
end try
on LargeTidsList(theText, tid)
local oldTids, newList, a, z, done
set oldTids to AppleScript's text item delimiters
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 thn 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 {oldTids}
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.