2013-11-15 2 views
0

airplay 장치가 연결되어 사용되고 있는지 확인해야하는 스크립트를 수행하고 싶습니다.
여러 곳에서 검색을 시도했지만이 문서를 찾을 수없는 것 같습니다. 누구에게 어떻게 할 수 있습니까? 내가하는 데 필요한 무엇인지 설명을위한 추가 응용 프로그램 : 내가Airplay 장치가 연결되어 있는지 확인하려면 어떻게해야합니까

global okflag 
set okflag to false 
set front_app to (path to frontmost application as Unicode text) 

-- check if iTunes is running 
tell application "System Events" 
    if process "iTunes" exists then 
     set okflag to true --iTunes is running 
    end if 
end tell 

if okflag is true then 
    set CV to output volume of (get volume settings) 

tell application "iTunes" 
    if (player state is playing) then 
     set currentVolume to the sound volume 
     set Timer to "" 
     display dialog "Sleep Time (Minutes)" with title "iTunes Timer" default answer Timer buttons {"Cancel", "OK"} default button 2 
     set Timer to text returned of the result 
     set the_button to button returned of (display dialog "Shutdown after countdown?" with title "iTunes Timer" buttons {"No", "Yes"} default button 2) 
     delay Timer * 60 
     repeat with i from currentVolume to 0 by -1 
      set the sound volume to i 
      delay 0.6 
     end repeat 
     pause 
     set player position to (player position - 60) 
     --Restore original volume 
     set the sound volume to currentVolume 
     if the_button is "Yes" then tell application "System Events" 
      shut down 
     end tell 
    else 
     display dialog "Nothing Playing" with title "iTunes Timer" giving up after 2 
    end if 


end tell 

else 
display dialog "iTunes is not running" with title "iTunes Timer" giving up after 2 

end if 

편집이이 현재 코드

if airplay device is in use then //(pause for longer) 
else //(the script that is already there) 

:
더 나가의 라인을 따라 뭔가있는 스크립트를 원 명확히하기 위해 찾아보십시오

+0

내 대답 업데이트 – markhunte

답변

0

흠.

그러나 iTunes에서 스트리밍 할 때 상태를 얻는 방법을 찾지 못했습니다. (지금까지)

그러나 에어 슬라이드가 확장 된 바탕 화면 공간 또는 미러링으로 사용되는 경우 운동을 통해 시스템 프로필에서 디스플레이에 대해 선택됩니다. SPDisplaysDataType

이 앱 스크립트는 최소한 계정입니다.

 set connected to "" 
try 
    set connected to do shell script "system_profiler SPDisplaysDataType | grep -i \"AirPlay\" " 
    if connected contains "Connection Type: AirPlay" then 
     set connected to "Connected as a Display or mirroring" 
    end if 
on error err 
    log err 
    if err contains "The command exited with a non-zero status" then 
     --do somthing 
     set connected to "Not connected as a Display or mirroring" 
    end if 
end try 
connected 

UPDATE *

아이튠즈 지금 일부 AirPlay를 명령을 명령. 그들이 언제 나타나는지 확실하지 않습니다. 사용 그러나 하나의 예 :

tell application "iTunes" 
     set isPlaying to player state 


    if isPlaying is playing then 
      log isPlaying 
      set airPlayEnabled to AirPlay enabled 
      if airPlayEnabled then 

        log airPlayEnabled 

      else 

       airPlayEnabled 
    end if 


     else 

      log isPlaying 
     end if 

    end tell 

에어 플레이는이에 대해 실행되는 아이튠즈 플레이어 AFAIK 수 있었다. 그리고 Airplay 장치를 점령하고있을 수있는 다른 장치를 위해

+0

이걸 주셔서 감사합니다, 내가 찾던 것이 아니지만 아마 제대로 말하지 않았을 것입니다. 멀리, 내가 특정 키를 누르면 iTunes에서 사운드를 페이드 아웃 한 다음 다시 시작하고 다시 재생하기 시작하는 프로그램을 실행합니다. 내가하고 싶은 것은 airplay에 연결될 때 더 큰 지연이 사라지기 때문입니다. 항상 페이드 인을 무효로하는 연결 지연입니다. – AlexGadd

+0

질문을 편집하고이 정보와 원하는 것을 설명하는 데 도움이되는 정보를 추가 할 수 있습니까? 상기 앱을 포함합니다. – markhunte