0

私は現在、いくつかのスクリプトインターフェイスのもの(ScriptingBridge?)からiTunes用に生成されたヘッダーを使用しています。現在再生中の曲の名前を取得できます

[[iTunes currentTrack] name];

でも、曲再生の現在時刻がわからないようです。現在、Applescriptを使用していません。

編集:ScriptingBridgeを介して確実に生成されます。ヘッダーを生成しました

sdef /Applications/iTunes.app | sdp -fh --basename iTunes
4

2 に答える 2

3

見つけた:[iTunes playerPosition]

于 2012-07-24T20:33:32.760 に答える
1

これはAppleScriptです。あなたがそれを使用していないことは知っていますが、ScriptingBridgeでこれを行う方法がわかりません。私の知る限り、このメソッドは似ていますが、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 --
于 2012-07-24T20:01:44.410 に答える