Looking for an action to activate/deactivate text to speech

Hello,
In SP ➜ Accessibility ➜ Speech , there is an option to activate or deactivate the Speak selected text checkbox.
Is there any way that this could be done in KBM?
I had rather concentrate all my shortcuts in KBM.
Thank you very much

image

Since Keyboard Maestro can execute shell scripts, this is a fairly convenient way to access the setting using the defaults command:

To get the current setting, use this command:

defaults read com.apple.speech.synthesis.general.prefs SpokenUIUseSpeakingHotKeyFlag

This returns 0 (unchecked) or 1 (checked). To change the setting, use this command:

defaults write com.apple.speech.synthesis.general.prefs SpokenUIUseSpeakingHotKeyFlag -bool true|false

where one of either true (checked) or false (unchecked) is specified.

2 Likes

Hi @ronald,

To be honest, this request has me a little confused. As far as I know, leaving this checkbox on all the time shouldn't interfere with anything else on your Mac unless you also want to be able to use its shortcut for something other than speaking selected text, so unless that's your goal I'm not sure why you want to be able to turn it on and off frequently.

That said, I can suggest replacing this system shortcut with a macro like this, especially since it lets you use a different voice and speaking speed than the system voice:

Speak Selected Text.kmmacros (2.6 KB)
55 PM

1 Like

thank you. Gglick’s macro below solved the problem.
Thanks again for taking the time to consider my request.

Thanks very much. Exactly what I was looking for.
Because of past mishaps and confusion, I am trying to centralize all shortcuts in KBM. In some cases in the past, when shortcuts did not work it was time consuming to find in which app the conflicting shortcut had been configured. In know that in a few months, I will have forgotten about the speech shortcut itself.
Your macro is great.
I work in 3 languages: english mostly, and also french and german.
Is there any way that I could choose the language when I activate the macro ?
thanks again

1 Like

Glad my macro proved useful! I don’t believe there’s any way to dynamically change the Speak Text action’s language, but you can accomplish functionally the same thing just be making identical macros with the same shortcut to trigger a conflict palette and giving each macro the language-appropriate voice.

1 Like

You answered my question: it is the voice which determines the language.
thank you