• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: stack overflow ???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >stack overflow ??? (From: Monsoft <email@hidden>)

  • Prev by Date: Re: GraphicConverter & saving files in new places
  • Next by Date: Re: Stuck trying to use creatorid to control IE
  • Previous by thread: stack overflow ???
  • Next by thread: Re: stack overflow ???
  • Index(es):
    • Date
    • Thread