Pude modificar algunos de los scripts que ya existen y hacer que funcionen en Lion. Para crear estos scripts:
- Ejecutar el editor de AppleScript
- Cree dos nuevos archivos de script vacíos (command-N)
- Pegar en estos dos scripts
- Guárdalos como algo como "opción de comando de intercambio" y "opción de comando de restauración" o lo que quieras
- Puede probarlos ejecutándolos en el editor de Applecript.
Aquí está el script para cambiar el comando a la opción, y la opción para mandar:
#
# Script to swap the Command and Option keys
# in the System Preferences Keyboard settings.
#
# Helpful if using a PC keyboard
#
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell process "System Preferences"
click button "Modifier Keys…" of tab group 1 of window "Keyboard"
# Select keyboard: pop up button
click pop up button 5 of sheet 1 of window "Keyboard"
# The 4th choice there.. my USB Keyboard
click menu item 4 of menu 1 of pop up button 5 of sheet 1 of window "Keyboard"
# The Option Key pop up
click pop up button 2 of sheet 1 of window "Keyboard"
# Change it to Command, the 4th choice
click menu item 4 of menu 1 of pop up button 2 of sheet 1 of window "Keyboard"
# The Command Key pop up
click pop up button 1 of sheet 1 of window "Keyboard"
# Change it to Option, the 3rd choice
click menu item 3 of menu 1 of pop up button 1 of sheet 1 of window "Keyboard"
click button "OK" of sheet 1 of window "Keyboard"
end tell
end tell
tell application "System Preferences"
quit
end tell
Aquí está el script para volver a intercambiarlos:
#
# Script to restore the Command and Option keys to their defaults
# in the System Preferences Keyboard settings.
#
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell process "System Preferences"
click button "Modifier Keys…" of tab group 1 of window "Keyboard"
# Select keyboard: pop up button
click pop up button 5 of sheet 1 of window "Keyboard"
# The 4th choice there.. my USB Keyboard
click menu item 4 of menu 1 of pop up button 5 of sheet 1 of window "Keyboard"
# The Option Key pop up
click pop up button 2 of sheet 1 of window "Keyboard"
# Change it to Option, the 3rd choice
click menu item 3 of menu 1 of pop up button 2 of sheet 1 of window "Keyboard"
# The Command Key pop up
click pop up button 1 of sheet 1 of window "Keyboard"
# Change it to Command, the 4th choice
click menu item 4 of menu 1 of pop up button 1 of sheet 1 of window "Keyboard"
click button "OK" of sheet 1 of window "Keyboard"
end tell
end tell
tell application "System Preferences"
quit
end tell
Para facilitar el acceso a estos scripts, puede ir a las Preferencias del Editor de Applescript y marcar "Mostrar el menú del Script en la barra de menú". Luego, copie sus scripts al directorio de inicio Biblioteca / Scripts, es decir, / Users / ryan / Library / Scripts
Ahora puede acceder a ellos directamente desde el menú del script de la barra de menú.