2010-08-20 5 views
0
내가 다른 라디오 버튼을 선택하면 시스템 환경 설정의 라디오 버튼을 클릭합니다

조건 :애플 스크립트 UI 스크립팅 -이 같은

tell application "System Preferences" 
    activate 
end tell 

tell application "System Events" 
    tell process "System Preferences" 
     click menu item "Mouse" of menu "View" of menu bar 1 

if radio button "Right" is selected <-- pseudo-code 
    tell window "Mouse" 
     tell radio group 1 
      click radio button "Left" 
     end tell 
    end tell 
end if 

if radio button "Left" is selected <-- pseudo-code 
    tell window "Mouse" 
     tell radio group 1 
      click radio button "Right" 
     end tell 
    end tell 
end if 

end tell 
end tell 

사람이 작업을 수행하는 방법을 알아?

답변

1

다음 스크립트는 기본 버튼을 되돌아갑니다에 그것이 현재에 "오른쪽"로 설정되어있는 경우 "왼쪽"

tell application "System Preferences" 
    activate 
    set current pane to pane id "com.apple.preference.mouse" 
end tell 

tell application "System Events" 
    tell process "System Preferences" 
     tell radio group "Primary mouse button:" of window "Mouse" 
      if value of radio button "Right" is 1 then 
       click radio button "Left" 
      end if 
     end tell 
    end tell 
end tell 

"오른쪽"대부분의 사용자의 지옥을 혼동 뜻에 기본 버튼 설정.

+0

도움 주셔서 감사합니다. 작동 시키려면 else 문을 연결하기 만하면됩니다. 대부분의 사용자가 기본 버튼을 "오른쪽"으로 설정하면 걱정할 것입니다. 어깨 부상으로 인해 트랙볼을 사용할 때마다 손이 끊임없이 바뀝니다. – timkl