2009-12-28 5 views
1

모든 노래가 특정 기준과 일치하는지 어떻게 검색합니까? 예 : 다음과 같습니다.AppleScript로 iTunes를 검색하려면 어떻게해야합니까?

tell application "iTunes" 
    set tracks to (every file track of playlist "Library" whose name contains "Green") 
    repeat with t in tracks 
     display dialog (t as string) 
    end repeat 
end tell 

답변

4

두 가지를 제외하고는 다음과 같습니다. 먼저 tracks은 iTunes 스크립팅 사전의 예약어이므로 다른 것으로 바꾸십시오 (예 :ts). 두 번째로, 트랙을 t as string으로 문자열로 변환 할 수는 없습니다. 원하는 정보를 선택해야합니다. 예를 들어 이름을 원할 경우 name of t as string을 사용할 수 있습니다. 좀 더 자세히 알고 싶다면 name of t & " - " & artist of t; 더 복잡한 술어를 원한다면, whose 절에 붙이면됩니다. 예 : file tracks whose name contains "Green" and artist contains "Bird". 약간 다른 결과를 수있는 of playlist "Library"을 제거

tell application "iTunes" 
    repeat with t in (file tracks whose name contains "Green") 
     display dialog (name of t as string) 
    end repeat 
end tell 

하지만, 아마 :

당신은 골프에 약간의 스크립트를 원하는 경우, 다음으로 대체 할 수있다. 그것은 나의 빠른 테스트에서하지 않았다.

+0

아, 예약어를 알려 주셔서 감사합니다. 그것을 바꾸는 것이 트릭을 만들었습니다. 감사! – Bill

관련 문제