-1
好吧,坦白說,我不知道我在做什麼。我從我下載的腳本中借了很多代碼。我試圖弄清楚我的代碼到底出了什麼問題。起初,它不會編譯,然後我欺騙到最後這樣做(基本上刪除它說的是錯誤的任何東西)第一次applescript編碼問題
現在,超過2/3的我的代碼是灰色的,將無法正常工作。所以沒有進一步ado-這裏它是:
property progress_factor : 200
property separator : "-"
tell application "iTunes"
display dialog "\"Create Artist Folder\"
set lib to library playlist 1
set numAllTracks to (get count of lib's file tracks)
set everyPlaylist to (get name of every user playlist)
set the count to 0
set ofi to fixed indexing
set fixed indexing to true
try
with timeout of 300000 seconds
repeat with i from 1 to numAllTracks
set thisTrack to (get a reference to file track i of lib)
tell this Track to set {art, alb, dbid} to {get Artist as string, get database ID}
if (art is not) then
set new_playlist_name to (art) as text
else if
set new_playlist_name to " * "
end if
--make new playlist if it doesn't exist
if everyPlaylist does not contain (new_playlist_name as text) then
set newPlaylist to (make playlist with properties {name:new_playlist_name})
set end of everyPlaylist to new_playlist_name
end if
-- Cycle through playlists of main library
set thisPlaylist to (get a reference to file playlist i of lib)
-- get Playlist properties
tell thisPlaylist to set {art} to {get artist as string, get database ID}
-- Folder Playlist to put Playlist
if (art is not) then
set new_folderplaylist_name to (art) as text
else if
set new_FolderPlaylits_name to " * various or unnamed
-- make new Folder Playlist if it doesn't exist
if everyFolderPlaylist does not contain (new_folderplaylist_name as text) then
set newFolderPlaylist to (make FolderPlaylist with properties {name:new_folderplaylist_name})
end if
set thecount to thecount + 1
set fixed indexing to ofi
if frontmost then
if gave up of (display dialog "Done" buttons {"Yay!"} ¬
default button 1 with icon 1 giving up after 300) then error number -128
end if
end tell
我真的很感謝每一點幫助。我也意識到這在新的iTunes中並不是一個完全必要的功能,但我真的想寫自己的。
謝謝!
該腳本的預期行爲是什麼?發生了什麼呢? –