Re: can't make { . . . } into an item [error message]
Re: can't make { . . . } into an item [error message]
- Subject: Re: can't make { . . . } into an item [error message]
- From: monk <email@hidden>
- Date: Sat, 14 Jul 2001 18:53:39 -0400
-- 7/14/01 10:59 am: email@hidden said:
>
> hi way more advanced scripters than me
>
>
>
> i'm making progress with my script but for the life of me i can not read
>
> half a list, and set it to a variable, what is obviously with this excerpt?
>
> --
>
> repeat with i in _readsource
>
>
>
> set _item to (get some item of _readsource)
>
>
>
> set _1sthalf to (read _readsource as list in front of contents of _item
>
> using delimiter {return, space})
>
>
>
> . . .
>
>
>
> end repeat
>
> --
>
>
>
> thanks in advance
>
>
>
> h 'monk' elmer
>
> --
>
>
Could you be clearer as to what is that you want to do?
>
_readsourece is a list.
>
_item is an item of _readsource
>
what is _1sthalf ?
>
>
Regards
>
>
Deivy Petrescu
>
http://www.dicas.com
>
Tips for your Mac.
>
Dicas para o seu Mac.
>
mailto:email@hidden
>
mailto:email@hidden
yes sure,
here's the gist of it: i want to randomly select items form a list, which is
a user selected text file, and then write them into a new file, and on each
cycle of selection i need to remove the item that was selected and create a
new list from the remaining items to start over with, until the file is
empty,
it was my idea that i could 'remove' and item by building a new list that
did not include that item, the repeat works fine with arbitrary selection,
and the file is built ok, but it always includes the original items, so as
soon as i try to create a new source (by concatenating _1sthalf & _2ndhalf)
to read from i get errors, here's my current layout so far:
--
set _source to open for access (choose file with prompt "choose source to
mix:") with write permission
set _path to (path to desktop) as string
open for access file {_path & "mixed"} with write permission
set _readsource to (read _source as list using delimiter {return, space})
repeat with i in _readsource
set _item to (get some item of _readsource) as string
write _item & space to file {_path & "mixed"}
set _1sthalf to (get items from beginning of _source to _item as list)
set _2ndhalf to (get items from _item to end in _readsource as list)
set _readsource to (get _1sthalf & _2ndhalf as list) using delimiter
{return, space}
end repeat
close access _source
--
h 'monk' elmer
--
http://www.assemblage.org