我有以下脚本,可以成功地检索当前曲目并更新我的消息(iChat)状态,但是为了让它自主工作,我想我需要在循环中运行它?对此有何建议?
tell application "Rdio"
set theTrack to current track
set theArtist to artist of theTrack
set theName to name of theTrack
end tell
tell application "Messages"
if status is available then
set status message to ("♫ Playing in Rdio: " & (theArtist as string) & " - " & (theName as string))
end if
end tell发布于 2012-04-01 06:08:27
如果您想要查找,AppleScript Language Guide有这方面的细节,但基本过程是:
on idle处理程序中,即:在空闲时告诉应用程序"Rdio“将theTrack设置为当前曲目将theArtist设置为艺术家theTrack将theName设置为theTrack的名称end告诉应用程序"Messages”如果状态可用,则将状态消息设置为(“Rdio中播放的消息:”& (theArtist as string) &“-”& (theName as string)) end if end tell return 0 --将其更改为偏离默认的30秒。interval end idle
idle处理程序(默认情况下为每30秒)-您可以通过从idle处理程序返回一个整数值来更改该值,该整数值将被评估为下一次检查之前的秒数。如果你想变得花哨,并且Rdio AS接口支持它,你可以使用你歌曲的剩余播放时间,比如…)https://stackoverflow.com/questions/9873897
复制相似问题