Last active
October 5, 2015 01:07
-
-
Save cbuck/2728813 to your computer and use it in GitHub Desktop.
Automount network drives via ssid name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set SSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -I | awk '/ SSID: / {print $2}'" | |
if SSID is "officenetwork" then | |
tell application "Finder" | |
try | |
mount volume "afp://server.local/share1" | |
mount volume "afp://anotherserver.local/share2" | |
end try | |
end tell | |
set endresult to "Office" | |
else if SSID is "homenetwork" then | |
tell application "Finder" | |
try | |
mount volume "afp://icanhazfilez.local/share" | |
end try | |
end tell | |
set endresult to "Home" | |
else | |
set endresult to "fail" | |
end if | |
tell application "Growl" | |
set the allNotificationsList to ¬ | |
{"Office", "Home", "Fail"} | |
set the enabledNotificationsList to ¬ | |
{"Office", "Home", "Fail"} | |
register as application ¬ | |
"Mount Elements" all notifications allNotificationsList ¬ | |
default notifications enabledNotificationsList ¬ | |
if endresult = "Office" then | |
notify with name ¬ | |
"Office" title ¬ | |
"Office" description ¬ | |
"Drives mount successful" application name ¬ | |
"Mount Elements" icon of application "AirPort Utility.app" | |
else if endresult = "Home" then | |
notify with name ¬ | |
"Home" title ¬ | |
"Home" description ¬ | |
"Drives mount successful" application name ¬ | |
"Mount Elements" icon of application "AirPort Utility.app" | |
else if endresult = "fail" then | |
notify with name ¬ | |
"Fail" title ¬ | |
"Home/Office Network Not Detected" description ¬ | |
"Unable to mount network drive" application name ¬ | |
"Mount Elements" icon of application "AirPort Utility.app" | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment