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: "Marc K. Myers" <email@hidden>
- Date: Sun, 15 Jul 2001 09:42:51 -0400
- Organization: [very little]
>
Date: Sat, 14 Jul 2001 10:18:39 -0400
>
Subject: can't make { . . . } into an item [error message]
>
From: monk <email@hidden>
>
To: "applescript users (apple)" <email@hidden>
>
>
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})
Rather than use "some item" to chose a random selection from a list, you
could use the "random number" scripting addition to pick a random index
to an item in the list. Then you'd have the index to the item to use in
breaking the list into the part before the selected item and after the
selected item.
set theList to {"a", "b", "c", "d", "e"}
set listRef to a reference to theList
repeat until length of listRef is 1
set theCnt to length of listRef
set x to random number from 1 to theCnt
display dialog contents of item x of listRef
if x is 1 then
set listRef to rest of listRef
else if x is theCnt then
set listRef to items 1 thru -2 of listRef
else
set listRef to (items 1 thru (x - 1) of listRef) & [optn-L]
(items (x + 1) thru theCnt of listRef)
end if
end repeat
display dialog contents of item 1 of listRef
Where you see "[optn-L]", substitute the AppleScript continuation character.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[7/15/01 9:41:44 AM]