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

01
2014-01
  • Myklsan

    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.

  • Answers
  • Daniel Beck

    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


  • Related Question

    osx - How do you re-associate an Airport Time Machine backup after migrating to a new mac?
  • Corey Floyd

    I used the migration assistant to copy my files directly from my old Mac to a new one.

    My new Mac won't "link" Time Machine backup on my Airport disk.

    I can browse the old Time Machine backup, however.

    I did find the related article with this specific comment: http://www.macosxhints.com/comment.php?mode=display&format=threaded&order=ASC&pid=97623

    Unfortunately, my Mac still won't associate with the old Time Machine backup.

    Any advice?


  • Related Answers
  • Arjan

    I think you shouldn't try to do this.

    I used the migration assistant to copy my files

    So, you've copied your documents and some more (but not the whole backup), after you installed Mac OS X (or, onto a system that had OS X pre-installed)? If so, then the old backup is simply not a good representation of your current Mac.

    If you could somehow enforce a deep traversal (for this to happen, fseventsd on your Mac must be fooled into "events log in /Volumes/.. out of sync with volume. destroying old logs.", followed by Time Machine's "Event store UUIDs don’t match [..] Node requires deep traversal"), then maybe it will become a reliable full backup after all. And then this new backup, or any newer backup, can be used for a full system restore (but not using backups that were created before the deep traversal, as I think those certainly do not match your current Mac).

    If you really want to go that way, then we need more information about the problems you're currently facing. Anything in the log files (Console) for example?

    I can browse the old Time Machine backup, however.

    Using Finder, or using Time Machine? If, at any time, you want to restore files from any Time Machine Backup, then simply hold down Option while launching Time Machine (or while clicking the icon). This will change "Enter Time Machine" into "Browse Other Time Machine Disks".

  • dyve

    This is not my answer, this is a copy/paste of the article linked by the original poster, for easier reference:

    From: http://www.macosxhints.com/comment.php?mode=display&format=threaded&order=ASC&pid=97623

    I too have had to restore a Time Capsule-based TM backup, and it turns out that this procedure does work. The order of the commands is a little bit modified, but this should take care of things for you. In the proceeding code, let's assume that that "Time Capsule" is the internal disk of your Time Capsule, and "Backup of MyMac" is the name of the sparsebundle disk image volume that mounts when you normally back up to your Time Capsule. First off, double-click your old (correct) sparsebundle disk (MyMac_00f9e8d7c6b56.sparsebundle) image and mount that volume on your Desktop. Also, to reiterate, old MAC = 00:f9:e8:d7:c6:b5, new MAC = 00:1a:2b:3c:4f:56, as they are above.

    $ sudo fsaclctl -p /Volumes/Backup\ of\ MyMac -d
    $ sudo xattr -w com.apple.backupd.BackupMachineAddress 00:1a:2b:3c:4f:56 /Volumes/Backup\ of\ MyMac/Backups.backupdb/MyMac
    $ sudo fsaclctl -p /Volumes/Backup\ of\ MyMac -e
    $ cd /Volumes/Time\ Capsule
    $ sudo mv .00f9e8d7c6b56 .001a2b3c4f56
    $ sudo mv MyMac_00f9e8d7c6b56.sparsebundle MyMac_ .001a2b3c4f56.sparsebundle
    

    What we've done here is we've disabled and re-enabled ACLs within the sparsebundle volume (where Backups.db actually is) and used xattr to change the MAC address in the manner shown in the original hint. Next we went to the Time Capsule's volume and changed the MAC address file and the name of our backup to both reflect our new MAC address. I'm fairly certain this should work for Time Capsule-based TM backups...it has worked for me, so best of luck.

  • Corey Floyd

    Installing my dev copy of 10.6 over my Leopard install fixed this issue. I am not sure if 10.6 is "smarter" about Airport Drives/Time Machine OR if there were some preferences that a reinstall fixed.

    I can say that 10.6 "appears smarter" because it uses the Time Macing icon to indicate my Time Machine drive. Even when Time machine was working properly on my previous MacBook, it used a generic white drive icon.

    So if anybody else runs into this issue either an upgrade or reinstall should help.