Applescript to run when connection to specific network on OSx

1

I have an apple script that I can manually run that will connect to a couple network drives. I would like it to have that script run when my mac connects to a specific wireless network connection (SSID). Is there a way to attach the script to that action? The network drives are not available unless I am on that network.

This may not be the place to ask this since is not technically an applescript coding question but any suggestions will be appreciated.

Haeflinger

Posted 2014-07-02T15:18:27.923

Reputation: 111

Will ControlPlane work?

– ᔕᖺᘎᕊ – 2014-07-02T16:59:06.220

1Looks possible, I will take a look. – Haeflinger – 2014-07-07T13:06:07.027

Answers

1

This should work. Replace the variables as needed.

set workSSID to "WORK SSID NAME"
set workVolumes to "smb://YOUR NETWORK DRIVES"

set currentSSID to do shell script "/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | awk '/ SSID/ {print substr($0, index($0, $2))}'"

if currentSSID = workSSID then
    try
        mount volume workVolumes

    end try

end if

OrigamiEye

Posted 2014-07-02T15:18:27.923

Reputation: 113