How to change language of dictation on the fly in Ventura (or newer versions of macOS)
2
votes
1
answer
147
views
I use the speech dictation tool to dictate text. But I do so in two different languages. To change the language of the dictation tool requires mouse clicking a few times which I try to avoid (hence the use of dictation tool). Is there a way to create a keyboard shortcut that cycles between the two dictation languages?
## Previous knowledge on this topic
A previous answer was given in 2012 using Apple script and bash scripts, see [How to use applescript to toggle the language setting of new dictation tool (10.8)](https://stackoverflow.com/a/11720145/6371439) . Unfortunately this no longer works due to changes in macOS. Daniel suggests an alternate script in the same thread that worked in 2020, but as they correctly predict, it also no longer works in 2023.
I'm not able to adapt either of Daniel or Lri's scripts to work with Ventura. For reference, this is Lri's suggestion
delay 0.3 -- time to release modifier keys if the script is run with a shortcut
tell application "System Preferences"
reveal anchor "Dictation" of pane "com.apple.preference.speech"
end tell
tell application "System Events" to tell process "System Preferences"
tell pop up button 1 of tab group 1 of window 1
click
if value is "English (United States)" then
click menu item "French" of menu 1
else
click menu item "English (United States)" of menu 1
end if
end tell
end tell
quit application "System Preferences"
And this was Daniel's updated version
tell application "System Preferences"
reveal anchor "Dictation" of pane "com.apple.preference.speech"
end tell
delay 1
tell application "System Events" to tell application process "System Preferences"
tell pop up button 1 of tab group 1 of window 1
click
if value is "English (United States)" then
click menu item "Hungarian (Hungary)" of menu 1
else
click menu item "English (United States)" of menu 1
end if
end tell
end tell
quit application "System Preferences"
I have via some help surmised that the "updated name" of
com.apple.preference.speech
is x-apple.systempreferences:com.apple.Keyboard-Settings.extension
. But substituting this in either code above fails to yield positive results, instead giving me the following error
> error "System Settings got an error: Can’t get pane \"x-apple.systempreferences:com.apple.Keyboard-Settings.extension\"."
A similar question was asked recently , but got no answers.
## To sum up
I'm looking for a way to easily and quickly change between two languages in the dictation tool. The solution should preferably create a shortcut, and use either an apple script or a bash script. Though I am open to other solutions if they are viable.
---
# Edit, 2024-03-05
This question has been marked as a duplicate of a [previous answer](https://apple.stackexchange.com/questions/59323/how-can-i-change-the-language-for-dictation-on-the-fly) . This is wrong. The previous answer *might* have worked for old versions of macOS. My question is specific to Ventura (or now, Sonoma), as per the title. The inner workings of macOS has changed enough in the intervening years that that answer no longer works.
lxgr's suggestion of working with changing input methods seems to be the best solution so far. But I would prefer to not have to change my keyboard layouts when I'm dictating. So I hope we can keep the question open in case anyone else finds a solution.
Asked by Blue badger
(21 rep)
Jul 5, 2023, 08:15 AM
Last activity: Mar 5, 2024, 11:52 AM
Last activity: Mar 5, 2024, 11:52 AM