Give Your Mac A Voice-activated Self Destruct Command (Just Like Star Trek)

OS X Yosemite has a new feature called Dictation Commands.  This allows you to press Function key twice, speak your command, and then have the computer do something for you.  While there are some useful built in ones, it is much more interesting to make your own.

In this example, I make a Star Trek-style auto-destruct mechanism, which will destroy all the data on my hard drive and make it crash (not really, but there are ways to do this).

Create A Voice-activated Command For Your Mac

Enable Enhanced Dictation

Enable this feature in the Dictation & Speech section of System Preferences.  Make sure to check the box for Offline dictation.  If it is not already enabled, your computer will start to download a large package containing the voice recognition.

enhanced-dictation

Use Automator To Make A Custom Voice-activated Workflow

Open Automator then choose Dictation Command

dication-cmd

Create a workflow similar to the one below.

workflow

 

Detailed Step-by-step

  1. Open Automator
  2. In the Dictation Command: field, enter a name
  3. Search for Run Shell Script in the field on the top-left
  4. Drag-and-drop the result onto the blank area to the right
  5. Write your script

You can run basically any command or action you want.  I don’t actually erase my hard drive above, but I make the computer say (in a female computer voice) that the self-destruct sequence has been initiated.  You could also have fun with this and use afplay  to play an audio file such a real Star Trek one for that authentic feel.

Caveats

The commands mentioned like rm -rf /  will not actually run without some hacking.  The biggest problem you will run into is that it needs elevated credentials, such as using sudo , which requires you enter a password.  While there are ways around this, I won’t mention them here in this article.  You could, however, use a similar command to delete a folder or file that you have access to, such as any file in your home directory.

After saving your workflow, you will find an app was created in /Users/<your_user>/Library/Speech/Speakable Items .

speakable-items-folder

Enable Advanced Dictation Commands

Next, open System Preferences > Accessibility > Dictation and click Dictation Commands… Make sure the Advanced Commands checkbox is enabled.  Since you created the command in Automator, it should automatically show up.

If you have other previously-made workflows that you want to connect to a voice command, just click the + button to create a new command fill in the information to run your app.

custom-cmd

Execute Your Voice Command

Now, tap the Function key twice and you will get a small microphone icon and you should hear the Siri sound.  Say your command and your workflow will run.

dictation-icon

When your command is detected, it will display above the microphone icon.

command-recognized

12 Replies to “Give Your Mac A Voice-activated Self Destruct Command (Just Like Star Trek)”

  1. Awesome, i’m gonna set it up with the code

    “Code zero zero zero. Destruct. Zero.”

    don’t see anything that could possibly go wrong with that.

  2. Hi,

    Please forgive me. I have not used Automator before and despite wanting to use your instructions I need them be clearer. I get lost when you say “Create a workflow similar to the one below.” (Then you show a screenshot).

    Are you able to write out, the steps I need to take, one by one? Say exactly what needs to be selected/written. Assume no prior knowledge. If you or someone else can I’d really appreciate it.

    Cheers,
    Jeremy

  3. I have setup the command with afplay however the audio wont play whilst the dictation / microphone icon is open, is there a way round this?

        1. I can’t replicate the issue. It works for me but there is a slight delay after the command is recognized. Try doing a simple say command and see if that works.

Leave a Reply