set the outputFile to (choose file name with prompt "Choose where to save the file" default name "iTunes playlists.txt" default location (path to desktop))
set excludedPlaylists to {"Library", "TV Shows", "Music", "Movies", "Podcasts", "Purchased", "Genius", "Music Videos", "My Top Rated", "Recently Played", "Top 25 Most Played"}
set theList to {}
tell application "iTunes"
repeat with i from 1 to count of user playlists
if the name of playlist i is not in excludedPlaylists then
copy return to the end of theList
copy i to the end of theList
end if
end repeat
end tell
set fref to open for access outputFile with write permission
write (items 2 through end of theList as text) to fref
close access fref
Here is the result:
11
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Track 11 should not be there, and track 12 should. The name of track 11 is Top 25 Most Played, which is in the exclusion list.
What is going wrong?
-- Michelle