• 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
stack overflow error processing text file [relsit: can't make . . .]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

stack overflow error processing text file [relsit: can't make . . .]


  • Subject: stack overflow error processing text file [relsit: can't make . . .]
  • From: monk <email@hidden>
  • Date: Tue, 17 Jul 2001 19:04:37 -0400

-- 7/16/01 07:42 am: email@hidden said:

on the below script, which is working, i constantly get a 'stack overflow'
error message and the line:

mix(mytext, mymix)

is highlighted in script editor

the text file i'm trying to process is a simpletext file of 3,439 bytes, not
huge by any means

h 'monk' elmer
--
 %   %   %   % 
http://www.assemblage.org
 %   %   %   % 

> -- 7/14/01 09:06 pm: email@hidden said:
>
> i got deivy's original working, and changed the tid here and there for
> mixing items, added a write and close
>
> anyway though, i found that i always have 1 less item in the result than in
> the source file, i.e., if the source has 8 items, the result will have 7,
> and so on
>
> i don't mind randomly leaving out items, but is there a way to randomly
> include all items too?
>
> thanks
>
> <adapted script>
>
> set _source to open for access (choose file with prompt "choose source to
> mix:") with write permission
> set _mix to open for access file (((path to desktop) as string) & "mixed")
> with write permission
>
> set mytext to (read _source as list using delimiter {return, space}) -- this
> is the equivalent of _source
> set mymix to (read _mix as list using delimiter return) -- this is the
> equivalent of _mix
>
> mix(mytext, mymix) -- this mixes the original source into the new mix
>
> on mix(mytext, mymix)
> set zlist to {}
> set text item delimiters to {space} -- change to get items, lines, or
> paragraphs
> set mymix to text items of mymix
> set mytext to text items of mytext -- these two lines coerce text into
> list
> set pcount to count of text items of mytext
> repeat with l from 1 to pcount
> set zlist to zlist & l -- creating a list to take an element out of
> end repeat
> set k to contents of some item of zlist -- random element chosen
> set mymix to mymix & text item k of mytext -- added to _mix
> if k = pcount and k = 1 then --only one line in the _source, let's
> finish it up
> set mytext to ""
> set mymix to rest of mymix
> set mymix to mymix as string
> set text item delimiters to "" -- restaure to default
> return mymix
> end if
> if k > 1 and k < pcount then set mytext to (text items 1 thru (k - 1) of
> mytext) & (text items (k + 1) thru pcount of mytext) as list
> if k = 1 and pcount > k then set mytext to items 2 thru pcount of mytext
> as list
> if k = pcount and pcount > 1 then set mytext to text items 1 thru
> (pcount - 1) of mytext as list
> mix(mytext, mymix) -- using recurence. You want to do it until _source
> is empty
> end mix
>
> write result to file (((path to desktop) as string) & "mixed")
> close access _source
>
> <adapted script>


  • Follow-Ups:
    • Re: stack overflow error processing text file [relsit: can't make . . .]
      • From: monk <email@hidden>
References: 
 >Re: can't make { . . . } into an item [error message] deivy's original again (From: monk <email@hidden>)

  • Prev by Date: Re: can't make { . . . } into an item [error message] deivy's original again pt. 2
  • Next by Date: (OFF) An Apology...
  • Previous by thread: Re: can't make { . . . } into an item [error message] deivy's original again pt. 2
  • Next by thread: Re: stack overflow error processing text file [relsit: can't make . . .]
  • Index(es):
    • Date
    • Thread