2017-04-21 4 views
1

일부 AppleScript를 작성하여 Alphred를 Keyboard Maestro로 토글하려고합니다. Alfred가 창으로 활성화되지 않은 것처럼 보이기 때문에 Alfred 창을 비활성화하기 위해 현재 사용하고 있지만 사용하지 않는 코드가 있습니다. AppleScript : Toggle Alfred

set appName to "Alfred 3" 
set is_start to false 

tell application "System Events" 
    if not (exists process appName) then 
     set is_start to true 
    else 
     if visible of process appName then 
      set visible of process appName to false 
     else 
      set frontmost of process appName to true 
     end if 
    end if 
end tell 

tell application "Alfred 3" 
    reopen -- open a default window if there are no open windows 
    activate -- make frontmost 
end tell 

해결책을 찾기 위해 도움이 필요

...

감사합니다.

답변

0

참고 : Alfred 및 Keyboard Maestro는 기능이 겹치기 때문에 또는 중 하나를 사용하면 충분할 수 있습니다. 정품 인증을 전환하기위한 알프레드 자체에 구성된 글로벌 단축키를 보내

tell application "Alfred 3" to search # activates Alfred 

에만비활성화를 얻을 수 있습니다

프로그래밍, 알프레드는 활성화하지 비활성화를 제공 , Alfred가 활성 인 동안; 기본적으로,이 단축키를 ⌥Space 입니다 :

tell application "System Events" to keystroke " " using {option down} 

따라서, 알프레드 자신의 바로 가기 키가 토글 이라고 주어진 당신이 할 필요가있다 :

tell application "System Events" to keystroke " " using {option down} 

주의 할 : 이 AppleScript를 호출하는 데 사용하는 Keyboard Maestro 바로 가기가 Alfred 전환과 관련된 수정 자 을 포함하는 경우 작동하지 않습니다.