I pleased to share my response to another Ask Mac Automator question. Though the workflow in response to this particular solution may not seem to apply to most people, it actually does, because it shows how the workflow in one application can be used in another to application to solve a particular problem. Here’s the problem:
Can you please help me find a way to open the Accessibility Keyboard quickly. At the moment I have to go to system preferences/Accessibility/keyboard/toggle keyboard on. I've made a feedback report to Apple for a quick toggle but it hasn't been addressed. I'm a C3 complete tetraplegic with no hand movement and use a combination of head mouse, Keystrokes/dwell click and Dragon but both Keystrokes and Dragon have now stopped mac development so I am being forced to use Apple Accessibility keyboard and dictation. Thanks for any help you can —Michael
[wps_note size=”17″ background=”#fae588″ color=”#333333″ radius=”3″]By the way, Micheal is correct about Dragon Dictate. Nuance has abandoned the program. I still use Dragon Dictate, and only a few features don’t work. When I upgrade to Mojave, Dragon Dictate will probably no longer work. At this point, Apple’s voice-to-text dictation program is still underdeveloped. However, its dictation program is a good option. [/wps_note]
Researching a Script
My first thought when thinking about a workflow solution was to see if Keyboard Maestro or Automator had an action to open Accessibility Keyboard in System Preferences. Unfortunately they don’t have such an action. So I did a Google search and discovered that someone had posted an AppleScript script that opened the Accessibility Keyboard. (Unfortunately I don’t have AppleScript skills, but most of the time when I do a search for a script I find a solution.)
I knew that the macOS Dictation feature ran Automator workflows, so I opened Automator and pasted the script in the Run Script action.
Alas, when I ran the script, it came back with error message that said, Automator “is not allowed assistive access.” WTF! Automator, a native macOS program, is not allowed assistive access? Has Apple abandoned the program that much?
[wps_alert type=”primary”]Note: at the end of this article, there’s a summary all the steps for all the instructions. [/wps_alert]
The Keyboard Maestro Solution
Since Keyboard Maestro is a hundred times better than Automator, I knew it would be able to run the script, so I created a workflow using the Execute an AppleScript action.
Keyboard Maestro ran the script just fine and opened the Accessibility Keyboard. Now I just needed the Dictation Command to run the KM script.
Keyboard Maestro includes several ways to trigger an action, including an AppleScript script. For each KM macro an AppleScript script is created for the macro. You simply select it in the Trigger area of the macro editor.
So basically, I’m using a script to trigger the macro that triggers the AppleScript script. Hope that makes sense.
Now, to confuse you just a little more, I copied the script for the macro and inserted it in the Automator action, and I saved that action as an Automator Workflow, to be attached to the macOS dictation command.
Creating Dictation Command
Now we just need to create a Dictation Command, which is pretty easy.
Open System Preferences > Accessibility > Dictation
You will need to enable Keyboard > Dictation in System Preferences in order to use the Dictation Commands.
In Dictation, click on the Dictation Commands…button and click the + button to create a new dictation command.
Set up the command to run “While using > Application,” and then where it says, “Perform,” choose “Other” and attach the saved Automator workflow.
Where it says, “When I say:,” type the words you will use to trigger the command.
Issue the Command
Now the dictation command is created, all you need to do is run it by issuing the voice command.
You can actually leave Dictation Command running on your Mac, and it will only activate after you say your assigned keyword phrase.
Summary of Steps
- Copy the AppleScript script.
- Create a new Keyboard Maestro macro, and paste the script into the KM Execute AppleScript action.
- Give the action a name, and copy the AppleScript trigger script.
- Paste the macro script into a new Automator workflow and save it as a workflow, not an application.
- Open System Preferences > Accessibility > Dictation, and create a new Dictation Command. Add the Automator workflow to the command and give assign words for the command, (e.g., “Open Accessibility Keyboard”)
- Test the workflow by issuing the command with the Apple Dictation feature enabled.
I hope the above workflow makes sense. It does require several steps, but once it’s created, it will save several clicks and mouse movements to open the Accessibility Keyboard.
Let me know what questions you have about the workflow and how you might use something similar in your own dictation command workflows.
You Have Question?
If you have an automation question, use this form to ask it.