Hi, I am trying to export all of the track names of a given playlist to a text file.
It results in my text file starting with “listutxt” (and some funky characters) and each additional entry with “utxt” and I don’t know why this is happening… I tried pasting the output of my text file in here both with quote and without, both result in this message board freaking out and erasing my message after “listutxt”… What is the deal?!
– Anyway, I also was originally trying to have this script export the tracks of the currently selected playlist, but I could not get current playlist to work… Can anyone advise on this?
set playlistInfo to {}
tell application "iTunes"
activate
set x to text returned of (display dialog "enter playlist's name" default answer "")
set myTracks to playlist x's tracks
repeat with theTrack in the myTracks
set myName to theTrack's name
set myArtist to theTrack's artist
set myAlbum to theTrack's album
set info to "Song: " & myName & ", Artist: " & myArtist & " (from the album: " & myAlbum & ")" & return & return
copy info to the end of playlistInfo
end repeat
set folderchoice to choose folder default location (path to home folder) with prompt "Select folder where playlist contents are to be saved" without invisibles
set folderchoice to (folderchoice & "itunes_playlist_export2.txt") as string
set docName to folderchoice as list
set docPointer to (open for access docName with write permission)
set eof of docPointer to 0
write playlistInfo to docPointer
close access docPointer
end tell