AppleScript to Reveal Keyboard Shortcut System Preferences

The top AS to open the 'Text' tab of the Keyboard Prefs works. When I try the one below to open 'Shortcuts' it fails.

Aren't they the same, just different?
(These are not part of a macro)
(Using Monterey)

Thanks for your help.

Keyboard Maestro Actions.kmactions (1.3 KB)

Hey Steve,

This is because Apple delights in screwing with you...

Run this in Apple's Script Editor or preferably Script Debugger.

(Note – the commercial version of SD reverts to a freeware "lite" version after a demo period, and this is still waaay more powerful than the ASE.)

tell application "System Preferences"
   tell pane "Keyboard"
      anchors
   end tell
end tell

Note the names of the anchors...

-Chris

If I'm following this, then @Steve_E needs to change the name of the anchor from "Shortcuts" (which would be totally consistent naming with "Text") to "shortcutsTab" (which is inconsistent in two different ways), right?

Thanks Apple (scoffing)

And a real thanks to you Chris. What a naming mishmash. I think my Open Prefs Palette will be a success now.

P.S. I already like Script Debugger

Apple has taken this to a new level with macOS Ventura. :scream:

In Ventura, this yields:

error "System Settings got an error: AppleEvent handler failed." number -10000

Note: In Ventura, the above script gets automatically changed to:

tell application "System Settings"
	tell pane "Keyboard"
		anchors
	end tell
end tell

I was first aggravated by these changes* when I discovered that the macro Set Sound Output was no longer working with Ventura.

*Actually, that's not true. I was first aggravated by these changes when I opened the System Settings application after "upgrading" to Ventura. :poop:

1 Like