Sunday, January 23, 2022

#1 2022-01-06 04:56:23 am

tiagorocha1979
Member
Registered: 2020-06-22
Posts: 14

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:

Applescript:

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? 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! smile

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

Last edited by tiagorocha1979 (2022-01-06 05:08:19 am)

Offline

 

#2 2022-01-06 06:13:11 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 5474

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

tiagorocha1979 wrote:

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:

Applescript:

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


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

Applescript:

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


NG

Offline

 

#3 2022-01-06 11:08:53 am

tiagorocha1979
Member
Registered: 2020-06-22
Posts: 14

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

Thank you SO MUCH!

That works like a charm and it's even cleaner and shorter than "my" code! big_smile
Really appreciate your time and help!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)