我目前使用的是一些脚本接口(ScriptingBridge?)生成的iTunes头文件。我可以得到当前正在播放的歌曲的名称
[[iTunes currentTrack] name];但是我似乎不能得到歌曲播放的当前时间。我现在没有使用Applescript。
编辑:明确通过ScriptingBridge生成。我用以下命令生成了标题
sdef /Applications/iTunes.app | sdp -fh --basename iTunes发布于 2012-07-25 04:33:33
找到了: iTunes playerPosition
发布于 2012-07-25 04:01:44
这是AppleScript;我知道您没有使用它,但是我不知道如何使用Scripting Bridge来实现它。据我所知,该方法应该类似但更接近objective-c语法。
tell application "iTunes"
set this_time to time of current track as string
set elapsed_seconds to player position
set this_elapsed_minutes to round elapsed_seconds / 60 rounding down
set this_elapsed_seconds to elapsed_seconds mod 60
if {1, 2, 3, 4, 5, 6, 7, 8, 9, 0} contains this_elapsed_seconds then
set this_elapsed_seconds to "0" & (this_elapsed_seconds as string)
end if
end tell
return (this_elapsed_minutes & ":" & this_elapsed_seconds & " of " & this_time) as text --https://stackoverflow.com/questions/11637067
复制相似问题