2011-08-04 9 views
1

다음 applescript를 사용하여 spotify에서 노래를 건너 뛸 수 있습니다. 전체 화면 응용 프로그램이 가장 앞에있을 때 스크립트를 호출하면 스크립트가 끝난 후 응용 프로그램이 표시되지 않습니다. 그것은 다른 공간에있을 것입니다. 가장 앞쪽에있는 응용 프로그램을 다시 볼 수있는 방법이 있습니까?applescript로 공간을 변경하는 방법

 
set front_app to (path to frontmost application as Unicode text) 

tell application "Spotify" 
    next track 
end tell 

tell application front_app to activate 
+0

가능한 모든 공간을 통해 루프이 스크립트를 사용할 수 duplicate of http://stackoverflow.com/questions/2305491/applescript-opening-an-app-in-space-number-n – cwd

답변

1
set front_app to current application 

tell application "Spotify" 
    next track 
end tell 

tell front_app to activate 
+0

코드는 훨씬 좋아 보이지만 똑같이 작동합니다. front_app이 전체 화면 응용 프로그램 인 경우 스크립트가 실행 된 후에도 여전히 볼 수 없습니다. – Kim

+0

@Kim : 아, 좋아. 라이온이 설치되어 있지 않아 전체 화면 앱으로 확인할 수 없습니다. 그런데 어떻게 스크립트를 시작 하시겠습니까? 예 : 내장 스크립트 메뉴, Quicksilver, FastScripts 또는 무엇인가? 아마 발사기가 아닌 스크립트가 프론트 애플리케이션에서 포커스를 훔쳐서 돌려 보내지 않는지 궁금합니다. 그런 다음 다시 한 번 라이온스의 전체 화면 앱에 문제가 될 수 있습니다. – Flambino

+0

알프레드에서 스크립트를 시작합니다. 다음 노래, 이전 노래, 일시 정지 등을위한 스크립트가 있습니다. 현재 응용 프로그램이 전체 화면 응용 프로그램이 아닌 한 매력처럼 작동합니다. – Kim

2

이 아마 어디에서나을받지 않습니다,하지만 당신은 응용 프로그램을 타겟팅하는 나타날 때까지 당신이 ...

set front_application to current application 
tell application "Spotify" to next track 
tell application "Finder" to set collapsed of front_application to false --makes sure the app isn't minimized 
repeat 
    tell application "System Events" to keystroke (ASCII character 29) using {control down} 
    display dialog "Correct space?" buttons{"OK"} default button 1 giving up after 4 --don't click 'OK' if the current space isn't showing the target application 
    if gave up of the result is false then exit repeat 
end repeat 
+0

답변 주셔서 감사합니다.하지만 저는 눈에 거슬리는 방식으로 노래를 건너 뛰려고합니다. 그래서 대화 상자가 나타나기를 원하지 않습니다. – Kim

+0

'repeat' 루프 전에'응용 프로그램에 시스템 이벤트 "를 키 코드 53으로 알릴 수 있습니다. – fireshadow52

관련 문제