Creating Custom Dictation Commands With Automator

With Yosemite can use Automator to create commands that your Mac will react to using only your voice. In this example, we create a command that responds to the command 'day of week' with the spoken day of the week. You can now use JavaScript to create Automator scripts which makes this even easier to do.
Video Transcript / Captions
Closed captioning for this video is available on YouTube: Creating Custom Dictation Commands With Automator.

Hi, this is Gary with On today's episode let's look at using Automator to create new, custom dictation commands in Yosemite.

Under Mavericks you were able to do these text spoken commands that were separate from dictation. But now with Yosemite it is combined with the dictation functionality.

So if you go to System Preferences under Dictation this is where you can enable it. You want to enable Dictation and I believe you need to turn on Use Enhanced Dictation in order to be able to speak commands to your Mac though you can try it without it. By selecting this you are going to trigger a large download, almost a gig, of additional software for your Mac. It is great to have but you don't necessarily need it for the basics. But I believe you do need it for using speakable commands inside of dictation.

Then you want to check your Shortcut key here. I've got it set so you press the Fn key twice to trigger dictation.

Now you want to go to the Accessibility portion of System Preferences. Here you want scroll down and Select Dictation and click on Dictation Commands. This shows all these different dictation commands that you can use. Also, there is a checkbox for Enable advanced commands. By checking this it means that you will be able to trigger dictation even if there is no text input. So you are not using say a word processor. You just have the Finder selected. Normally you would not be able to hit the Fn key twice to dictate but you want to do that because you want to be able to speak commands.

We are going to leave this open here. There is a bunch of stuff here that is set as default commands for this but we are going to create our own using Automator.

So I'm going to run Automator and I'm going to create a new workflow here. But it is not a standard workflow. It is going to be a dictation command. This is only available in Yosemite. I'm going to choose that and I get to type exactly what I want to trigger the command. So you want to be careful.

I'm going, as an example, have something where I can ask my Mac what day of the week it is. Sometimes, is it Tuesday, is it Wednesday, you just want to know and you don't want to have it all the time up here in your clock. So instead of having to do like what day of the week is it, which is very easy for it to mistranslate I'm just going to do something simple, say Day of week and I'm not going to put a question mark after it because I have found out that that doesn't work very well. I'm going to enable the command and now I'm going to build something in here that will tell me what the day of the week is.

Another cool new thing in Yosemite is the ability to use JavaScript. You don't have to mess around with AppleScript which is very odd language. As a programmer I never liked AppleScript. It is very strange. But JavaScript is something that almost every programmer uses at some point if you have anything to do with the web.

So I'm going to put a little JavaScript in here in Automator and this is going to just give me the day of the week and return that. So here we go. Basically a one line program in JavaScript that just gets the day of the week as a number and then translates that using an array to an actual day that can be spoken. I'm going to search here for Speak Text and drag that underneath so it is going to take the output from this, pass it to here, and I can test it out very easily and quickly.

So you can see it takes Sunday, passes it through here, and it speaks Sunday.

Great. So all I need to do now is save this so it knows, of course, since this is a dictation command it is going to save this in a special place in the system under Dictation Commands. So I'm going to name it the same thing as what the command is itself. Why not. It makes it easy to figure out what it is.

Now if I switch over to System Preferences here and look at Dictation Commands; I found it usually takes a few seconds so if you go too quickly it won't be here, but it will be listed under User right here. I've got Day of week. I can enable or disable it.

So now that I know that it's there and working I can click somewhere. I'm going to click off here into the desktop on the Finder. I'm going to hit the Fn key twice; day of week, Sunday. So you can see here it works. It picks it up. You can see the little command appear above saying it recognized it and then it will run the script.

So this is a really simple script that just does something really basic but you can imagine you can do almost anything you want here in Automator including running Apps and performing different functions. Anything here that is in the library can be triggered by a dictation command this way.

Comments: 3 Responses to “Creating Custom Dictation Commands With Automator”

    Tripp Frohlichstein
    4 years ago

    I love your stuff-having used a Mac for years I still learn from your videos. Thank you. That said, JavaScript is above my pay grade. (That doesn’t mean you shouldn’t have done this one-I am sure it will help many). :-)

    Frank Katz
    4 years ago

    Is there any place to get pre-done commands for dictation.

    Recently purchased Dragon does not work in Yosemite and I will not purchase their new version. They offer no discounts .

      4 years ago

      You can search the web to see if someone else has posted something. Search for “Yosemite dictation command” plus a description of what you need the command to do. This is fairly new, so I’m not sure if there is much out there yet.

Comments Closed.