質問

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