编写脚本以帮助我保持我的播放列表在计算机之间保持同步。通过Applescript粘贴剪贴板时出错
我想我会通过applescript做到这一点。
上半年是出口到m3u,这是我陷入了困境。
的代码是:
property delimiter_character : " - "
tell application "iTunes"
set this_playlist to playlist "Alternative Mixtape"
set this_name to (the name of this_playlist) as string
set the playlist_count to the count of tracks of this_playlist
set playlist_data to {}
tell this_playlist
repeat with i from 1 to the count of tracks
tell track i
set the end of the playlist_data to {name, delimiter_character, artist, return, location, return}
end tell
end repeat
end tell
end tell
set FileName to "Path:To:File.m3u"
set theFile to open for access FileName with write permission
write playlist_data to theFile
close access theFile
问题是,我得到的各种“乱码”输出:
listlistutxt Hips Of The Yearutxt - utxtMistutxt
alisvvHDD…ÏXËH+Ï›Hips Of The Year.mp3χ»g∏mMp3 hookˇˇˇˇ Bye Bye…Ï<»»gúMϛϋ’.HDD:Music:Mist:Bye Bye:Hips Of The Year.mp3*Hips Of The Year.mp3HDD(/Music/Mist/Bye Bye/Hips Of The Year.mp3
我试着到剪贴板转换为纯文本,但我一直尝试复制为类UTF8或作为记录时出现错误。
非常感谢你,完美的作品。 我只需要运行一个grep就可以将它从posix转换为unix文件路径,我们很好。 **谢谢** – MrSunshine
不客气。如果你想在文件中使用unix风格的路径,那么将一行更改为...将trackLocation设置为(获取位置)的POSIX路径。 – regulus6633