组消息(iChat中)状态,以歌目前效力于RDIO [英] Set Messages (iChat) status to song currently playing in Rdio

查看:150
本文介绍了组消息(iChat中)状态,以歌目前效力于RDIO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下脚本成功检索当前跟踪和更新我的信息(iChat中)状态,但是对于这个自主工作,我想我需要在一个循环中运行呢?该建议?

 告诉应用程序RDIO
    集theTrack到当前曲目
    设置的艺人到theTrack的艺术家
    theName设置为theTrack的名字
告诉结束告诉应用程序消息
    如果状态可用,那么
        设置状态消息(在RDIO♫播放:及(如的艺人字符串)及 - 及(如theName字符串))
    万一
告诉结束


解决方案

除非RDIO已触发一定条件下的脚本(这你就必须检查自己,因为我不是一个RDIO用户自己的能力 - 在相当稀少在网站不表明有关的任何东西)RDIO AppleScript的文档,你最好的机会实现这一目标是你的脚本保存为的待在打开AppleScript的应用程序的,把合适的脚本在闲置处理程序。在<一个href=\"https://developer.apple.com/library/mac/#documentation/AppleScript/Conceptual/AppleScriptLangGuide/conceptual/ASLR_about_handlers.html#//apple_ref/doc/uid/TP40000983-CH206-SW7\"相对=nofollow>的AppleScript语言指南,如果你想看看它对这一基本事实,但基本程序是:


  1. 您的包裹上面的脚本在闲置的处理程序,即:

     闲置
        告诉应用程序RDIO
            集theTrack到当前曲目
            设置的艺人到theTrack的艺术家
            theName设置为theTrack的名字
        告诉结束    告诉应用程序消息
            如果状态可用,那么
                设置状态消息(在RDIO♫播放:及(如的艺人字符串)及 - 及(如theName字符串))
            万一
        告诉结束    返回0 - 改变这个从默认的30秒流浪。间隔
    结束闲置


  2. 脚本保存为的 AppleScript的应用程序的,因此一定要检查的继续开放的中保存表。


  3. 启动新创建的AppleScript的应用程序,你是好去 - 这将继续运行,定期执行空闲处理器(每30秒在默认情况下 - 你可以改变通过返回从空闲处理程序,它会直到下一次检查的秒数来评价一个整数值,数值。如果你想成为幻想,和RDIO AS接口支持它,你可以使用你的歌的剩余的出场时间,说...)

I have the following script that successfully retrieves the current track and updates my Messages (iChat) status, but for this to work autonomously I guess I need to run it on a loop? Recommendations for that?

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

解决方案

Unless Rdio has the ability to trigger scripts on certain condition (which you would have to check for yourself, as I am not a Rdio user myself – the rather sparse Rdio AppleScript docs on site do not indicate anything about that), your best chance to achieve this is to store your script as a Stay-Open AppleScript Application and put the script proper in the on idle handler. The AppleScript Language Guide has the nitty-gritty on this, if you want to look it up, but the basic procedure is:

  1. wrap your script above in an on idle handler, i.e.:

    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
    

  2. save the script as an AppleScript Application, making sure you check Stay open in the saving sheet.

  3. Launch your newly created AppleScript app, and you are good to go – it will keep running, executing the idle handler periodically (every 30 seconds by default – you can change that value by returning an integer value from the idle handler, which will be evaluated as the number of seconds until the next check. If you want to be fancy, and the Rdio AS interface supports it, you could use the remaining playing time of your song, say…)

这篇关于组消息(iChat中)状态,以歌目前效力于RDIO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆