Ich versuche, ein Applescript zu schreiben, um zu einem bestimmten Abschnitt der Systemeinstellungen zu gelangen - Tastatur> Verknüpfungen> Dienste und hoffentlich auch zu einem bestimmten Dienst. Ich habe einen Teil des Weges damit bekommen:
tell application "System Preferences"
activate
reveal anchor "shortcutsTab" of pane id "com.apple.preference.keyboard"
end tell
Dies bringt mich zum Shortcuts-Teil des Keyboard-Prefs-Bereichs, aber ich würde gerne weiter in die richtige Auswahl gehen. Gibt es eine Möglichkeit, einen bestimmten Dienst in diesem Einstellungsbereich auszuwählen? Letztendlich möchte ich den Endbenutzer anweisen, eine Tastenkombination für einen zuvor installierten Dienst zu ändern.
Hier ist ein Skript, das ich gerade geschrieben habe, das es tun wird. Dadurch gelangen Sie zur Registerkarte „Kurzbefehle“ des Einstellungsbereichs „Tastatur“ und wählen eine Zeile aus der linken und rechten Spalte aus:
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
Hier ist die Version, die Sie verwenden können, um die Zeilen nach Namen zu identifizieren. Irgendwie hacky, aber es sollte gut funktionieren.
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"…
IT scheint den Namen nicht annehmen zu wollen. Irgendwelche Tipps?
William T. Froggard