2015-01-13 61 views
0

我是新手appletscript和編程一般。有人會善意地查看我的代碼。我知道它還沒有正確的applescript語法,因爲我努力尋找信息。填補空白在itunes

tell application iTunes 
for each track in library playlist{ #all listed tracks, regardless of what files i have. may include dead links 
set tr to track name 
if file location is missing then search for it at external/Music/iTunes else messagebox(tr no file) 
if search has result cut and paste to Music/itunes 
check if file now exists else messagebox(tr error) 
} end tell 

回答

0

我會幫你開始。以下是您可以如何找到電腦上找不到的所有曲目的歌曲名稱和藝術家。你必須在此基礎上完成剩下的工作。

set missingTracks to {} 
tell application "iTunes" 
    set alltracks to tracks of library playlist 1 
    repeat with aTrack in alltracks 
     set theLocation to location of aTrack 
     set doesExist to my fileExists(theLocation) 

     if not doesExist then 
      set thisInfo to {songName:name of aTrack, songArtist:artist of aTrack} 
      set end of missingTracks to thisInfo 
     end if 
    end repeat 
end tell 
return missingTracks 


on fileExists(theLocation) 
    tell application "Finder" 
     if exists theLocation then 
      return true 
     else 
      return false 
     end if 
    end tell 
end fileExists 
+0

非常感謝。任何關於最好學習的地方的建議? – connor

+0

當我開始時,我在這裏找到了名爲「Applescript tutorials for beginners」的教程:http://macscripter.net/viewtopic.php?id=25631。祝你好運。 – regulus6633