juniorop
08-31-2003, 12:46 PM
Hello,
I am writting a script and while it works properly, i was wanting to add some features so that it is more user friendly.
The main issue is that i have a loop that goes through the library and creates a list of all the albums in the library. The problem is that if you have 200 songs it isnt an intensive loop, but for someone with over 3000 songs, it can take some time. Here is the code:
set this_playlist to the view of browser window 1
tell this_playlist
repeat with i from 1 to the count of tracks
tell track i
set theAlbum to (album of track i of this_playlist) as string
if theAlbum is in theAList then
--do nada
else if theAlbum is "" then
--do nada
else
set the end of the theAList to theAlbum
end if
end tell
end repeat
from here theAList is then passed to a subroutine, which uploads the selected album to an iPod and once that is executed the whole program is looped again to allow you to add more albums to the iPod.
I know that i can build a list of albums faster using this code:
set theLibrary to view of browser window 1
set theList to (album of every track in theLibrary)
choose from list theList with prompt "this is a test"
but i cannot figure out a way to remove the duplicate entries.
I would rather use the last bit of code as it is much faster and then remove the duplicates from theList, but I am not sure how to do that.
Also, is there any way to do a progress indicator with applescript. It would be quite a useful thing if i had to go the first route.
Thanks,
JO
I am writting a script and while it works properly, i was wanting to add some features so that it is more user friendly.
The main issue is that i have a loop that goes through the library and creates a list of all the albums in the library. The problem is that if you have 200 songs it isnt an intensive loop, but for someone with over 3000 songs, it can take some time. Here is the code:
set this_playlist to the view of browser window 1
tell this_playlist
repeat with i from 1 to the count of tracks
tell track i
set theAlbum to (album of track i of this_playlist) as string
if theAlbum is in theAList then
--do nada
else if theAlbum is "" then
--do nada
else
set the end of the theAList to theAlbum
end if
end tell
end repeat
from here theAList is then passed to a subroutine, which uploads the selected album to an iPod and once that is executed the whole program is looped again to allow you to add more albums to the iPod.
I know that i can build a list of albums faster using this code:
set theLibrary to view of browser window 1
set theList to (album of every track in theLibrary)
choose from list theList with prompt "this is a test"
but i cannot figure out a way to remove the duplicate entries.
I would rather use the last bit of code as it is much faster and then remove the duplicates from theList, but I am not sure how to do that.
Also, is there any way to do a progress indicator with applescript. It would be quite a useful thing if i had to go the first route.
Thanks,
JO