2012-03-26 3 views
3

現在のトラックを正常に取得してメッセージ(iChat)ステータスを更新する次のスクリプトがありますが、自律的に動作させるには、ループ?それのための推薦?現在のRdioで再生中の曲にメッセージ(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 

答えて

4

RDIOは、特定の条件でスクリプトをトリガする能力(私はRDIOユーザーではない午前として、ご自分で確認する必要があろう自分自身 - かなりまばらなRdio AppleScript docs on siteが、そのことについては何も示していない)がある場合を除き、あなたをこれを達成する最高のチャンスは、あなたのスクリプトをStay-Open AppleScriptアプリケーションとして保存し、on idleハンドラに適切なスクリプトを置くことです。あなたはそれを見てみたい場合はAppleScript Language Guideは、核心-ザラザラこの上を持っていますが、基本的な手順は次のとおりです。

  1. はすなわち、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 
    
  2. そのスクリプトをAppleScriptアプリケーションとして保存し、を開いて、保存シートにをチェックしてください。

  3. 新しく作成したAppleScriptアプリを起動し、あなたが行ってもいいです
  4. - それは、デフォルトでは30秒ごと(定期idleハンドラを実行、実行し続けます - あなたはidleハンドラから整数値を返すことによって、その値を変更することができ、次のチェックまでの秒数として評価されます。あなたが好きで、Rdio ASインターフェイスがそれをサポートしていれば、あなたの曲の残りの再生時間を使用することができます...)
+0

Beautiful。ありがとう! –

関連する問題