【问题标题】:Get duration of the current song in AppleScript获取 AppleScript 中当前歌曲的持续时间
【发布时间】:2013-10-17 16:11:51
【问题描述】:

我正在尝试制作一个脚本来获取当前歌曲的持续时间,但是当我这样做时,持续时间会返回为“缺失值”。有什么建议吗?

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

【问题讨论】:

    标签: applescript itunes duration


    【解决方案1】:

    您的代码在这里完美运行。例如,我播放 Bob Marley 的“How Many Times”,当我运行你的脚本时,对话框显示145.1920013427734。但是(当然)当我播放 Internet Radio 时,duration 不会返回任何内容。尝试本地轨道并再次运行您的脚本?只是猜测。 (iTunes 11.0.5 / OS X 10.8.2)

    【讨论】:

    • 是的。这回答了我的问题。我在做这个的时候正在听 iTunes Radio,这样就可以解释了。谢谢
    猜你喜欢
    • 1970-01-01
    • 2019-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-19
    • 2017-01-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多