Estoy tratando de escribir un applescript para llegar a una sección específica de las preferencias del sistema: Teclado> Accesos directos> Servicios y, con suerte, también a un servicio específico. He conseguido una parte del camino con esto:
tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
Esto me lleva a la parte de accesos directos del panel de preferencias del teclado, pero me gustaría profundizar más en la selección correcta. ¿Hay alguna forma de seleccionar un servicio específico en este panel de preferencias? En última instancia, quiero indicar al usuario final que cambie un método abreviado de teclado para un servicio instalado previamente.
Aquí hay un guión que acabo de escribir que lo hará. Esto lo llevará a la pestaña de accesos directos del panel de preferencias del teclado y seleccionará una fila de las columnas izquierda y derecha:
tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell application process "System Preferences"
repeat until (window 1 exists)
end repeat
tell window 1
#modify these to specify a row in the left column, or the right column, respectively
repeat until (row 3 of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)
end repeat
select row 3 of table 1 of scroll area 1 of splitter group 1 of tab group 1
repeat until (row 1 of outline 1 of scroll area 2 of splitter group 1 of tab group 1 exists)
end repeat
select row 1 of outline 1 of scroll area 2 of splitter group 1 of tab group 1
end tell
end tell
end tell
Esta es la versión que puede usar que identifica las filas por nombre. Una especie de hacky, pero debería funcionar bien.
tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
tell application "System Events"
tell application process "System Preferences"
repeat until (window 1 exists)
end repeat
tell window 1
#modify these to specify a row in the left column, or the right column, respectively
repeat until (rows of table 1 of scroll area 1 of splitter group 1 of tab group 1 exists)
end repeat
select (first row of table 1 of scroll area 1 of splitter group 1 of tab group 1 whose value of static text 1 is equal to "Services")
repeat until (rows of outline 1 of scroll area 2 of splitter group 1 of tab group 1 exists)
end repeat
select (first row of outline 1 of scroll area 2 of splitter group 1 of tab group 1 whose name of UI element 2 is equal to "Open URL")
end tell
end tell
end tell
select row "Open URL"…
, parece que no quiere tomar el nombre. ¿Algun consejo?
William T. Froggard