Switch Language in Dictation with KM

Hi, I'am new to KM and cannot find a way to switch t between languages for Dictation in System Preferences.
Here is my try that does not seem to work:
ITALIEN.kmmacros (2.0 KB)

Any help would be greatly appreciated. Thanks for your time.

I'm not sure how to do this with KM, but after cobbling pieces together from several sources and futzing around in UI Browser, this seems to work (on my system at least). Place this script in an Execute AppleScript Action. It's clunky and a bit ugly, but it works. The script could definitely be tidier too.


tell application id "com.apple.systempreferences"
	reveal anchor "Dictation" of pane id "com.apple.preference.keyboard"
end tell


tell application "System Events"
	tell process "System Preferences"
		set currentLanguage to value of attribute "AXValue" of pop up button 1 of tab group 1 of window "Keyboard"
		if currentLanguage is "English (United States)" then
			set newLanguage to "Italian (Italy)"
			tell pop up button 1 of tab group 1 of window "Keyboard"
				perform action "AXShowMenu"
				tell menu 1
					click menu item newLanguage
				end tell
			end tell
		else if currentLanguage is "Italian (Italy)" then
			set newLanguage to "English (United States)"
			tell pop up button 1 of tab group 1 of window "Keyboard"
				perform action "AXShowMenu"
				tell menu 1
					click menu item newLanguage
				end tell
			end tell
		end if
	end tell
end tell

quit application "System Preferences"

Sources:

2 Likes

Thank you so much for taking the tilme. It works perfectly ! Just what the doctor ordered. Have a nice day.

1 Like