Ever wanted to be notified when a certain wifi network becomes available?.
Maybe you are at University and the wifi goes up and down randomly. Just like the person I originally wrote this code for who is charged for mobile data when using their iPhone as personal hotspot during the Uni. wifi outage.
Here is a simple way of doing just that.
The code gets the available wifi list. And pops up a notification when the one you want is in the list.
[wce_code id=”2″]
[wce_code id=”3″]
on idle — A on idle handler will run the code within it and then set the app to idle. Using little cpu. It will then repeat this every #n of seconds ( determined by its return number)
set theWifi to “weehronetwork” — the wifi SSID
set theList to paragraphs of (do shell script “/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s| awk ‘{print $1}'”) — get the wifi list
if theList contains theWifi then
display notification with title “The WIFI” subtitle (theWifi & “ IS BACK UP”) sound name “Sosumi” — display a notification.
end if
return 60 — run again in #n seconds
end idle
Save the Applescript as an Application and check Stay open.
?
When you first run the App. and it displays a Notification, it will then be shown in the System preferences – -> Notifications. From here you can determine the Notification type.