2017-09-11 30 views
1

나는 controllermate라는 소프트웨어를 사용하여 키보드 나 마우스의 버튼 동작을 사용자 정의 할 수 있습니다. Apple 스크립트의 특정 기능에서 사용할 수있는 '구성 요소'중 하나입니다. 내가 복사 할 수있는 무언가가 현재 선택되어 있지만, 그렇지 않으면 다른 키보드 단축키를 실행하면 특정 버튼이 CMD + C를 실행하도록 내 마우스에 대한 사용자 정의 동작을 만들고 싶습니다. 텍스트를 선택했는지 판단하기 위해 appleScript를 사용해야하지만 다른 일부 사람들의 솔루션을 온라인에서 읽은 후에는 직접 구현하는 방법을 찾지 못했습니다. 어떤 도움을 주셔서 감사합니다.AppleScript로 무언가를 선택했는지 어떻게 알 수 있습니까?

답변

0

가 여기에 솔루션입니다 :

클립 보드에 빈 문자열을 넣어 CMD + C가, 클립 보드를 확인 할.

set the clipboard to "" 
tell application "System Events" to keystroke "c" using command down 
delay 0.2 

set b to false 
try 
    set b to (the clipboard as string) is not "" 
on error -- error when the clipboard contains a custom type (like a copy in the Photos Application) 
    set b to true 
end try 
if b then -- the clipboard does not contains an empty string 
    -- *** script to execute a different keyboard shortcut *** 
    --tell application "System Events" to keystroke someChar using someModifier 
end if