ramiro.araujo 32 Posted March 15, 2013 Share Posted March 15, 2013 Fantastic! thanks!! aiyo 1 Link to post
telonaes 1 Posted March 16, 2013 Share Posted March 16, 2013 Love your WiFi-Toggle-Workflow! Is there a way to add: open/close Dropbox to it? That would save a huge amount of batterie-life when I'm out and about with my macbook. Never mind. Rosenkrieger made one: http://www.alfredforum.com/topic/907-wifi-toggler/ aiyo 1 Link to post
dgarsys 0 Posted March 16, 2013 Share Posted March 16, 2013 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 Link to post
dgarsys 0 Posted March 16, 2013 Share Posted March 16, 2013 (edited) 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: Edited March 16, 2013 by dgarsys Link to post
dgarsys 0 Posted March 16, 2013 Share Posted March 16, 2013 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... Link to post
aiyo 35 Posted March 16, 2013 Author Share Posted March 16, 2013 (edited) 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... You are absolutely right. I've updated the workflow and it should now play nice with locations with spaces. You can download it here (or use the links in the first post) https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Network-Location/Network-Location.alfredworkflow Cheers, Jonas UPDATE: I just rewrote the workflow now searching works better. Edited March 16, 2013 by Jonas Eriksen Link to post
dgarsys 0 Posted March 17, 2013 Share Posted March 17, 2013 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. Link to post
aixxo 0 Posted March 18, 2013 Share Posted March 18, 2013 Hi, when I try to use the network location workflow I'm asked for admin password and the location isn't changed. Anything I have to do beside importing the workflow? I used the 1.x script for a long time with no problems! Thanks alot! Oliver Link to post
aiyo 35 Posted March 18, 2013 Author Share Posted March 18, 2013 Hi, when I try to use the network location workflow I'm asked for admin password and the location isn't changed. Anything I have to do beside importing the workflow? I used the 1.x script for a long time with no problems! Thanks alot! Oliver Hi, OSX 10.8 has increased the security in many areas. Because of this "networksetup" (the commandline tool I use in the Network Location Workflow) needs admin privileges for certain tasks. This is why you are requested for the password (it's all done by OSX). If you cancel this request (or mistypes the password or try a username that does not have admin privileges) the network settings are not changed! You could set permission suid to /usr/sbin/networksetup to make it run with root permission, but that opens up for misuse so I won't encourage that. Cheers, Jonas Link to post
aixxo 0 Posted March 18, 2013 Share Posted March 18, 2013 ok, i replaced the command with the line out of the v1 script: /usr/sbin/scselect 2>&1 | /usr/bin/egrep -i "\({query}" | /usr/bin/cut -c 4- | /usr/bin/cut -f 1 | /usr/bin/head -n 1 | /usr/bin/xargs /usr/sbin/scselect That seems to work quite well. :-) Link to post
aiyo 35 Posted March 18, 2013 Author Share Posted March 18, 2013 ok, i replaced the command with the line out of the v1 script: /usr/sbin/scselect 2>&1 | /usr/bin/egrep -i "\({query}" | /usr/bin/cut -c 4- | /usr/bin/cut -f 1 | /usr/bin/head -n 1 | /usr/bin/xargs /usr/sbin/scselect That seems to work quite well. :-) Thanks! I did not know about scselect. Nice that it does not need elevated privileges. The other commands is not needed (it is used to trim down the result of scselect). I have updated Network Location to use scselect now! Thanks again! Cheers Link to post
aixxo 0 Posted March 18, 2013 Share Posted March 18, 2013 Thanks! I did not know about scselect. Nice that it does not need elevated privileges. The other commands is not needed (it is used to trim down the result of scselect). I have updated Network Location to use scselect now! Thanks again! Cheers Your welcome, all credit belongs here : http://jamesoff.net/site/2011/06/09/alfred-script-to-change-network-location-in-os-x/ Link to post
aiyo 35 Posted March 30, 2013 Author Share Posted March 30, 2013 The Wifi switch throws 404 Sorry about that. I've updated the link and it works again. Cheers Link to post
Davide 9 Posted October 7, 2013 Share Posted October 7, 2013 I have updated Fast User Switching which fixes the "(logged in)" and "RealName:" issues. https://github.com/aiyodk/Alfred-Extensions/raw/master/AlfredApp_2.x/Fast-User-Switching/Fast-User-Switching.alfredworkflow Hi Jonas, thank you for this workflow! One thing: I have deactivated the guest account but the workflow shows me it. Possible to change that? Link to post
Davide 9 Posted October 7, 2013 Share Posted October 7, 2013 Hi Jonas, everything works perfect now. Had to enable and disable the guest account once and then it disappeared. Link to post
petebocken 3 Posted January 29, 2014 Share Posted January 29, 2014 (edited) I'm trying to get this to pass the selected location name to notification center. If I use {query} it displays something like "CurrentSet updated to 5775F97D-8B7A-4D2B-578...." Edited January 29, 2014 by petebocken Link to post
erinsnow 0 Posted November 15, 2015 Share Posted November 15, 2015 Excellent workflow! I have two wifis in my house, which are switched between all day long. Never did I find such a switch workflow except this kind of On/Off toggles. Please help~ thank you. Link to post
CageD 1 Posted April 26, 2016 Share Posted April 26, 2016 Superb! Using the Fast User Switching workflow is the best next to sliced bread! Link to post
octothorpe 2 Posted January 16 Share Posted January 16 (edited) Sorry to resurrect this old thread, but it seems this fast user switching workflow has (after all these years) stopped working under Big Sur. Anybody have a good, current workflow that lets one quickly switch users using Alfred? Edited January 16 by octothorpe Link to post
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now