문제

I'm trying to make a script to get the duration of the current song, but when I do this the duration comes back as "missing value". Any suggestions?

tell application "iTunes"
    if player state is playing or player state is paused then
        set theDuration to (get duration of the current track)
        display dialog theDuration
    end if
end tell
도움이 되었습니까?

해결책

Your code works perfectly here. For example, I play "How Many Times" from Bob Marley and when I run your script the dialog shows 145.1920013427734. But (of course) when I play Internet Radio, duration will return nothing. Try a local track and run your script again ? Just guessing. (iTunes 11.0.5 / OS X 10.8.2)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top