2015-01-13 5 views
0

저는 appplescript 및 프로그래밍에 익숙하지 않습니다. 누군가 내 코드를 살펴볼 정도로 친절 할 것입니다. 나는 그 정보를 찾기 위해 애 쓰고 있기 때문에 적절한 applescript 문법이 아님을 안다.아이튠즈에서 부족한 부분을 채우십시오.

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

처음 시작할 때 http://macscripter.net/viewtopic.php?id=25631에있는 "초보자 용 AppleScript 자습서"라는 자습서를 만들었습니다. 행운을 빕니다. – regulus6633

관련 문제