2010-08-20 5 views
0

Je veux cliquer sur un bouton radio dans les Préférences Système si un autre bouton radio est sélectionné, comme ceci:UI-scripts AppleScript - conditionnelle

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 

quelqu'un sait comment faire cela?

Répondre

1

Le script suivant retournera le bouton principal de « gauche » si elle est actuellement réglée sur « Right »:

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 

Réglage du bouton principal de « droit » ne confondez pas l'enfer de la plupart des utilisateurs.

+0

Merci pour votre aide! Juste besoin de brancher une autre instruction pour le faire fonctionner. Vous avez raison, la plupart des utilisateurs s'inquiètent si leur bouton principal est réglé sur «Droite». Cependant, en raison d'une blessure à l'épaule, je change constamment de mains lorsque j'utilise mon trackball. – timkl