Script to open the "System Preferences > Keyboard > Text" tab?

UPDATE: I think I found a way, changing the script from another user that used it for the Shortcuts tab. Here’s the code and please let me know if there’s a better way to write it, that takes less time and all that:

tell application "System Preferences"
	activate
	set current pane to pane id "com.apple.preference.keyboard"
	tell application "System Events"
		click radio button "Text" of tab group 1 of window "Keyboard" of application process "System Preferences"
	end tell
end tell

If this is good, can I add this to the contextual menu?


Initial post

I’m trying to find a way to create a keyboard shortcut using Better Touch Tool to open the “System Preferences > Keyboard > Text” tab, because I see myself adding new words there and I want to make the process easier and faster.

Can someone provide me with the script, please? :slight_smile:

Also, is there a way to add options to the contextual menu (for example when I highlight a word and right click) that would automatically read that script?
Similar to the “Learn Spelling”, but in this case it would run the script and open the Text tab.

Thanks! :slight_smile:

Model: MacBook Pro 13" Mid 2012
AppleScript: 2.11
Browser: Safari 605.1.15
Operating System: macOS 10.15

Hi. This would be better as it doesn’t use GUI Scripting:

tell application "System Preferences"
	activate
	reveal anchor "Text" of pane id "com.apple.preference.keyboard"
end tell

Thank you SO MUCH!

That works like a charm and it’s even cleaner and shorter than “my” code! :smiley:
Really appreciate your time and help!