Re: Eliminating duplicate items from a list
Re: Eliminating duplicate items from a list
- Subject: Re: Eliminating duplicate items from a list
- From: Kevin Bradley <email@hidden>
- Date: Thu, 13 Sep 2007 10:53:45 -0500
Sorry I'm a bit late getting into this conversation, but I've been using the code below in an iTunes script to get album names of every track and then strip out any that are duplicates:set allAlbumsList to {}
tell application "iTunes" set albumList to album of file tracks of library playlist 1 whose podcast is false set tcount to count albumList end tell
--remove duplicates repeat with i from 1 to tcount tell my albumList's item i to if it is not in my allAlbumsList and it ≠ "" then set end of my allAlbumsList to it end repeat display dialog "Processing " & (count of allAlbumsList) & " Albums" giving up after 5
The repeat loop is the fastest construction in Applescript I've found thus far for this sort of thing. I have a moderate iTunes library of about 1300 songs from 125 albums, and (assuming iTunes is already activated, launching takes time) the display dialog pops up almost instantly.
Hope this helps.
Kevin Bradley Message: 4 Date: Tue, 4 Sep 2007 13:31:02 +1100 From: Brett Conlon <email@hidden> Subject: Eliminating duplicate items from a list To: email@hidden Message-ID: <email@hidden">email@hidden> Content-Type: text/plain; charset="us-ascii"
Hi all,
In Lotus Programming I can wrap a list in an @Unique(List variable) command and it strips out all duplicate items. What is the simplest way to do it in AS?
I'm thinking it may have to be with a repeat and using text item delimiters, right?
Cheers,
Cojcolds
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden