2015-01-13 59 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