Workaround for Keyboard Maestro no longer speaking text in Yosemite

I use Keyboard Maestro for automation, but also to help me quickly get information on my Mac. For example, I have hotkeys which speak the current time, and battery status.

When I upgraded my Mac to Yosemite I first dealt with the Keyboard Maestro Yosemite Accessibility workaround (accessibility in this case, referring to granting Keyboard Maestro permission to control one’s Mac).

Next, I noticed that my macros which spoke things, no longer worked. The Keyboard Maestro Frequently Asked Questions mentions this issue, and calling out to a shell script instead of Keyboard Maestro’s internal Speak Text action:

There is a bug in the NSSpeechSynthesizer that returns isPlaying as false immediately. This means the Speak Text Action in Keyboard Maestro finishes immediately, so the text is not spoken. As a workaround, you can set a variable named “Text to Speak” to the text you want, then you can use the Execute Shell Script action with the command: say “$KMVAR Text to_Speak”

Of course this works, and doesn’t require too much effort to write a wrapper script around the Mac OS X say command which uses my desired voice and speech rate, but I’d rather keep using the Keyboard Maestro provided Speak Text action, presuming that the NSSpeechSynthesizer / isPlaying bug will be fixed. I also didn’t really feel like editing my macros, then reverting them later – too much work in Keyboard Maestro’s UI can get a bit tedious using Apple VoiceOver.

It turns out that a workaround with less impact, is to follow the macro Speak Text action, with a Pause action which waits for at least the number of seconds you expect it will take to speak your text. I believe this works, because it causes the macro to continue running, while the text has a chance to be verbalized, since isPlaying is incorrectly returning false to Keyboard Maestro and presumably causing the macro to exit immediately.

Supporting the above “keep the macro running while text is spoken” theory: I have a macro which speaks some status text, and then rsyncs data to a USB stick – since that macro takes a few seconds to run my rsync script, my “starting to copy…” text is spoken.

For more information on the Speak Text and Pause Keyboard Maestro actions, see the Keyboard Maestro Actions page.

Now, when this bug is resolved, I can just remove the Pause action from macros,.

Advertisements
This entry was posted in Automation and tagged , . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s