Hi There,
first of all I want to thank everybody in this forum for precious help.
I’m doing a script which get all albums and their artist to populate a table and make a choice.
What I’ve done is:
on showAlbums()
set text color of every data cell of every table column of table view "my_table" of scroll view "my_scroll" of window "choose" to "white"
tell application "iTunes"
set theList to {}
set dupcheck to {}
repeat with n in every file track of playlist "Phone"
if (dupcheck does not contain n's album) then
set end of theList to {n's album, n's artist}
set dupcheck to dupcheck & {n's album, n's artist}
end if
end repeat
end tell
set theDataSource to make new data source at end of data sources with properties {name:"albums"}
make new data column at end of data columns of theDataSource with properties {name:"Albums", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
make new data column at end of data columns of theDataSource with properties {name:"Artist", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
set data source of table view "my_table" of scroll view "my_scroll" of window "choose" to theDataSource
append theDataSource with theList
tell table view "my_table" of scroll view "my_scroll" of window "choose" to update
end showAlbums
this piece of code gets the artist and album of every track in my playlist phone, checks the duplicates and with result sets the data source for the table.
It works fine until I use it with a small playlist.
When I try to use this code with my whole library (1560 songs) it takes very very long time to finish.
Any suggestion to speed up?
Note: I’m pretty new of applescript so don’t blame me for my crappy code.
Thanks,
Max