How can i turn my Airport On & Off with Speech Recognition on my Mac?

0

I've an iMac running Snow Leopard & I'd like to activate the internal Airport via Speech Recognition. I imagine a script would be involved but I've never utilized one before. Also I'm interested in an auto-generated log of when the Airport is on.

Myklsan

Posted 2010-09-19T14:03:32.277

Reputation: 1

If my answer helped you, please accept it. If not, please comment on what's missing. Thanks! – Daniel Beck – 2010-10-26T13:57:01.167

Answers

2

The command line way to control Airport is networksetup.

Typing networksetup | grep airport in the Terminal reveals:

Usage: networksetup -getairportnetwork <device name>
Usage: networksetup -setairportnetwork <network> <device name> [password]
Usage: networksetup -getairportpower <device name>
Usage: networksetup -setairportpower <device name> <on off>

So this is what you want for controlling AirPort.

Wikipedia says:

Mac OS X v10.4 added Automator workflows which can also be used as Speakable items.

If a workflow is saved as an application and put in the Speakable items folder it becomes available to the speech recognition software. The words the computer will recognize to execute the command will be the name of the saved Automator application. Some words might have to be misspelt for the computer to know the proper pronunciation. (For example, the computer best recognizes "Les Misérables" as Lay Mizzer Ob).

You can determine the location of speakable items by going to System Preferences, Speech, Speech Recognition, Open Seakable Items Folder. For me, it's /Users/username/Library/Speech/Speakable Items

Create an Automator application using the Run Shell Script item, call networksetup with appropriate parameters (e.g. networksetup -setairportpower en1 on for enabling), save it as an application, store it in the speakable items directory determined above. Use the command you want to speak as application name.

Edited to add:

Here was another answer previously regarding the log. I think it refered to /private/var/log/kernel.log.

Grep AirPort (or type AirPort in the Console.app search box after selecting kernel.log under /private/var/log in the tree on the left) and you should see corresponding log messages, including

AirPort: Link Down on en1. Reason 8 (Disassociated because station leaving).

or

AirPort: Link Up on en1

Daniel Beck

Posted 2010-09-19T14:03:32.277

Reputation: 98 421