Re: Is this possible?
Re: Is this possible?
- Subject: Re: Is this possible?
- From: Emmanuel <email@hidden>
- Date: Wed, 28 Feb 2001 21:19:09 -0600
At 0:12 -0600 28/02/01, Ian Sterling wrote:
>
I would like to be
>
able to have applescript choose a specified number of random mp39s and copy
>
them to my mp3 folder on my powerbook. The part that has me stumped is
>
choosing the random files.
Here is how I should go. Not providing the full solution, just a few hints.
1. build a list of the paths of all the files. Say we name it "theList"
2. count it:
-----------------
set nFiles to (count theList)
-----------------
3. choose randomly an item:
-----------------
set anIndex to random number from 1 to nFiles
set aPath to contents of item anIndex of theList
-----------------
4. copy it into the PB
5. delete it from the list, and update the counter:
-----------------
set theList to (suppress item anIndex from theList)
set nFiles to nFiles - 1
-----------------
(requires the free Satimage osax)
Repeat steps 3 - 4 - 5 as many times as needed.
HTH
Emmanuel