Applescript 将消息(iChat)状态设置为当前在Rdio中播放的歌曲
我有下面的脚本,它成功地检索了当前曲目并更新了我的消息(iChat)状态,但是为了让它自动工作,我想我需要在循环中运行它?对此有何建议Applescript 将消息(iChat)状态设置为当前在Rdio中播放的歌曲,applescript,Applescript,我有下面的脚本,它成功地检索了当前曲目并更新了我的消息(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 sta
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
除非Rdio能够在特定条件下触发脚本(您必须自己检查,因为我自己不是Rdio用户,所以很少有人指出这一点),实现这一点的最佳机会是将脚本存储为保持打开的AppleScript应用程序,并将脚本正确地放入空闲的
处理程序中。如果您想查找它,则基本步骤如下:
将上面的脚本包装在一个on idle
处理程序中,即:
on idle
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
return 0 -- change this to stray from the default 30 sec. interval
end idle
将脚本另存为AppleScript应用程序,确保在保存表中选中“保持打开”
启动新创建的AppleScript应用程序,您就可以开始了–它将继续运行,定期执行idle
处理程序(默认情况下,每30秒–您可以通过从空闲
处理程序返回一个整数值来更改该值,该整数值将作为下一次检查之前的秒数进行计算。如果您想更有趣,并且Rdio as接口支持它,您可以使用歌曲的剩余播放时间,例如…)