2011-09-14 4 views
0

는 내가 달성하기 위해 노력하고있어 이것이다 : 물론Apple Script : iTunes에서 다음 트랙에 대한 참조를 얻으려면 어떻게해야합니까?

tell application "iTunes" 
    play next track with once 
end tell 

, '다음 트랙'는 명령을, 그리고 다음 트랙에 대한 참조입니다 - 그래서이 작동하지 않습니다. 나는 문서를 훑어 보았고 실제로 이것에 붙어있다. 어떻게 작동하도록 코드를 작성할 수 있을까?

재생 목록이나 그 밖의 모든 것을 만드는 데 솔루션이 필요한 경우 - 다음 곡을 재생 한 다음 중지하는 스크립트가 필요합니다.

-

어떤 도움을 많이 감사합니다 :) 이미이 작업을 얻을려고 많은 시간을 낭비했습니다!

답변

0

훨씬 장난 후이 내가 그것을하고있어 방법이다. 당신이 더 좋은 방법을 볼 수 있다면 나는 알고 싶습니다!

tell application "iTunes" 

    set is_playing to false 

    if player state is playing then 
     set is_playing to true 
    end if 

    tell playlist "Cinderella" 

     set track_number to 1 
     set should_repeat to true 
     repeat while should_repeat is true 

      if track track_number exists then 
       tell track track_number 
        set play_count to (get played count) 
        if play_count is 0 then 
         set should_repeat to false 
        else 
         set track_number to track_number + 1 
        end if 
       end tell 
      else 
       repeat with track_ref in tracks 
        tell track_ref 
         set played count to 0 

        end tell 
       end repeat 
       set track_number to 1 
      end if 
     end repeat 

     if is_playing is true then 
      set played count of track track_number to 1 
      tell application "iTunes" 
       stop 
      end tell 
     else 
      play track track_number with once 
     end if 

    end tell 

end tell 
1

이 스크립트는 해키이지만, 작동 ...

tell application "iTunes" 
    next track 
    set this_track to the name of the current track 
    previous track 
end tell 
+0

고마워요! 이게 거의 ​​... 유일한 것은 iTunes가 트랙을 멈춘 후에 작동하지 않는다는 것입니다 (현재 트랙을 얻을 수 없다고 말합니다). ? –

+0

@Jordan 편집을 참조하십시오. – fireshadow52

+0

@thanks하지만 이전과 같은 문제가 있습니다. 나는 그럭저럭 해결책을 계산할 수 있었다 :) –

관련 문제