2015-06-28 31 views
-1

我遇到此問題: 在腳本編輯器中運行此腳本時,它完美地工作。在AppleScript中獲取iTunes播放器狀態

tell application "iTunes" 
set playerstate to get player state 
end tell 
display dialog playerstate 

我拿到最佳球員的狀態runningstoppedpaused。 但是,如果我導出腳本的應用程序,我得到類似kPSS

錯誤在哪裏?

回答

0

player state是一個枚舉常量(實際上是一個整數)。 只是要挾值文本

tell application "iTunes" 
    set playerstate to (get player state) as text 
end tell 
display dialog player state 

編輯:

這也應該工作,一個applet

tell application "iTunes" 
     if player state is paused then 
      set playerStateText to "Paused" 
     else if player state is playing then 
      set playerStateText to "Playing" 
     else 
      set playerStateText to "Stopped" 
     end if 
    end tell 
    display dialog playerStateText 
+0

我不工作,你的腳本的結果是'«常數* *** kPSS»' – user121028

+0

對不起,我會發布另一個(工作)解決方案 – vadian

+0

謝謝,它的工作原理! :) – user121028

相關問題