• 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
FW: can't make { . . . } into an item [error message] deivy's original
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: can't make { . . . } into an item [error message] deivy's original


  • Subject: FW: can't make { . . . } into an item [error message] deivy's original
  • From: monk <email@hidden>
  • Date: Mon, 16 Jul 2001 04:52:44 -0400

> I am not sure I fully understand
> but this is the script that I came up with if you want to mix
> the lines of text of two files. This will only stop if the source
> file is empty.
> The example I sent you is with two text strings
> I did my best, hope I understood!

ok too: this was the original solution you'd sent, now this compiles but i
always end up with an empty file - if life were only so easy, any idea why?
that was what happenend to me whenever i tried to build a new list to choose
from . . . :(

howie 'monk'

>
> <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 "this is the begining of my text
> this is the second line of my text
> this is the third line
> and finally the forth line " -- this is the equivalent of _source
>
> set mymix to "" -- 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 return -- you want to get the 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
>
> </script>
>
> Deivy Petrescu
> http://www.dicas.com
> Tips for your Mac.
> Dicas para o seu Mac.
> mailto:email@hidden
> mailto:email@hidden


  • Follow-Ups:
    • Re: FW: can't make { . . . } into an item [error message] deivy's original
      • From: Deivy Petrescu <email@hidden>
  • Prev by Date: Re: FM insert Picture
  • Next by Date: Re: FM insert Picture
  • Previous by thread: Re: Applescript & cgi
  • Next by thread: Re: FW: can't make { . . . } into an item [error message] deivy's original
  • Index(es):
    • Date
    • Thread