MacOS – way to auto switch wireless networks depending on signal strength

macbook promacoswifi

I have a Linksys dual band router. Near the back of our house (which is where our computers are mostly located) only the G network really comes through so when I'm working in the front of our house, I like to connect to the N network for the extra speed. Unfortunately we are unable to move our router. If it is possible, I would like my Mac to automatically switch networks depending on the signal strength. Is there a way to do this?
Our Macs are running 10.8.
Thanks

Best Answer

Not saying this is ideal or works well. But Just to give you an idea.

You can use command line tools to write a script that checks the strength. and then changes the network as needed.

To get the strength you can use this command line code:

/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I |grep -i "agrCtlRSSI:"

Look at the man pages for /usr/sbin/networksetup for changing the setup.

As an example here is a quick applescript. It only runs once as it is only an example of use. But in your script I would do it as a LaunchAgent There is an app called lingon that simplifies the writing of LaunchAgents. LaunchAgents can startup apps, run scripts at specific times, regularly or when something happens.

I hope this helps

set wifi1 to "wifissid1"
set wifi2 to "wifissid2"

try
    set strength to last word of (do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I |grep -i \"agrCtlRSSI:\"") as number
    log strength
end try
set network to do shell script "/usr/sbin/networksetup -getairportnetwork en1"
log network



if strength is less than 50 then



    if network is not equal to "Current Wi-Fi Network: " & wifi1 then

        do shell script "/usr/sbin/networksetup -setairportnetwork en1 " & wifi1 & " &> /dev/null & "

    end if



else

    if network is not equal to "Current Wi-Fi Network: " & wifi2 then

        do shell script "/usr/sbin/networksetup -setairportnetwork en1 " & wifi2 & " &> /dev/null & "

    end if

end if