I’m so tickled I can’t stand it. All right, so Speech Recognition stuff on a Mac is pretty darn cool by itself, but now I’ve got a nice Apple Script that opens up Safari with various tabs of my favorite sites, and it does this when I tell my Macbook “Get on it.” Here’s how I did it:

  1. Under System Preferences > Speech > Speech Recognition, make sure “Speakable Items” is set to “On.” By default, to issue a voice command, you’ll have to hold down the Esc key while you talk. I changed mine to the back tick because I use Esc in other applications to do other things; it’s whatever works for you. If you want to change this, change the “Listening Key”.

  2. Open Applications > AppleScript > Script Editor and enter the following code:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
     property links : {"http://mail.google.com/mail/", "http://www.3till7.net/wp-admin/", "http://dubious.nu/forum/index.php?action=unread", "http://icanhascheezburger.com/"}
     tell application "Safari"
             activate
             set currWindow to front window
    
             repeat with link in links
                     make new tab at the end of tabs in currWindow with properties {URL:link}
             end repeat
     end tell
    

    Thanks to Takashi Yoshida for the basis of this script. Feel free to change the links shown to whatever you want Safari to open up with. I imagine this script could also be customized for Firefox, Opera, or whatever other browser you use, but that might take some fiddling around.

  3. Hit the Compile button in Script Editor and make sure the code gets syntax highlighted nicely, with no warnings displayed. Go ahead and save this script wherever you would like, but give it a name like “Get on it” or something like that. Not “get_on_it”, but using spaces and everything.

  4. Copy your snazzy new script to Library > Speech > Speakable Items. If you’re copying the script with Finder, that is your local Library, so the one inside your home folder.

  5. Hold down Esc (or whatever you set your Listening Key to be) and say, clearly, “Get on it”. If all goes well, Safari should pop open with your links opened in separate tabs, with a blank tab showing. If you already have Safari open, this will just open up those links in new tabs, leaving your current tabs alone.</li></ol>

Pronunciation Issues

Being a southern girl by the grace of God and all that jazz, I have a bit of an accent. For me, my Apple Script works better if I name it “Getawnit”, which looks more akin to how I sound so that the voice recognizer does a better job of understanding me. You want how the Mac says it to match how you’re saying it. One way to test this is to have the Mac say the written version of what you want to say as your command:

  1. Under System Preferences > Speech > Text to Speech, check “Speak selected text when the key is pressed”. Then choose “Set Key…” to choose which key combination you want to hit to make the Mac read selected text. Just hit the desired combination while the little window is open. I have Option+S set for mine.

  2. Open Applications > TextEdit. Type in how you think you sound when you’re saying the desired command. For example, I made a script that will activate when I say “I’m bored,” but for me, my words run together and I speak quickly, so “Mbord” is the name I chose for my script.

  3. Select the text you just typed and hit the key combination you entered in System Preferences (like Option+S). Does the Mac’s voice match how you plan to speak the command? If so, then you have a good file name for your script.</li></ol>

Technical note: you’ll need a microphone for this to work, obviously. I’m using a Macbook with a built-in microphone and I’m running OS X Leopard.