Jump to content

dgarsys

Member
  • Content Count

    5
  • Joined

  • Last visited

  1. Thank you - that worked, awesome. At some point I'll have to parse how you worked around that... as sed/awk is not something I'm comfortable with yet.
  2. Requires the installation of blueutil, available via Mac brew, and assumes a symlink or other link to blueutil available at: /usr/local/bin/blueutil If you have brew installed, use the command: brew install blueutil If not, install blueutil on your own, or install brew first. http://midknightgallery.com/storage/workflows/Toggle_Bluetooth.alfredworkflow Keyword for bringing up the toggle is "bluetooth"
  3. The heart of the matter seems to be that bash breaks arrays up on spaces. I got the listing right by resetting the $IFS environmental variable to a newline, but that still hasn't allowed me to switch to a new location...
  4. Hmmm.. grabbed the listing portion of the script and modified it to run in the standard bash shell just to see the output as follows by getting rid of the query lines... #!/bin/bash CURRENT_LOCATION=$(networksetup -getcurrentlocation) echo "<items>" #if [[ -z "{query}" ]] #then LOCATIONS=$(networksetup -listlocations) #else #LOCATIONS=$(networksetup -listlocations | grep -i "{query}") #fi for LOCATION in $LOCATIONS do if [[ "$CURRENT_LOCATION" != "$LOCATION" ]] then echo "<item uid=\"network location $LOCATION\" arg=\"$LOCATION\"><title>$LOCATION</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item>" fi done echo "<item uid=\"\" arg=\"\"><title>$CURRENT_LOCATION (selected)</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>no</valid></item>" echo "</items>" The output was as follows - with line breaks... <items> <item uid="network location Manual" arg="Manual"><title>Manual</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location Automatic" arg="Automatic"><title>Automatic</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location Wired" arg="Wired"><title>Wired</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location In" arg="In"><title>In</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location Google" arg="Google"><title>Google</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location DNS" arg="DNS"><title>DNS</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location Automatic" arg="Automatic"><title>Automatic</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location (Wifi" arg="(Wifi"><title>(Wifi</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="network location First)" arg="First)"><title>First)</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>yes</valid></item> <item uid="" arg=""><title>Automatic (Wifi First) (selected)</title><subtitle>Network Location</subtitle><icon>icon.png</icon><valid>no</valid></item> </items> So, when I use the workflow:
  5. Hi, I really appreciate the work put into this. One note: the "network location" workflow doesn't deal well when the location names have spaces in them.... I'll see if I can figure out why it breaks up on spaces, as the "networksetup -listlocations" command doesn't break on spaces
×
×
  • Create New...