Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

anton1s

macrumors member
Original poster
Jun 17, 2012
59
0
Hi All

What i am trying to achieve is to map external drives from my NAS only when my MBA is connected on a specific SSID

I found few scripts that check the SSID and I have the relevant applescript. There is a variable you can use with automator but this is only to display the IP and not the current SSID.

The way I have it so far is (Automator application is called MapDrives):

automator:
1) pause 7 seconds
2)Get value of variable (IP)
3)Run Applescript below (the script needs tweaking)

Code:
on run {input, parameters}
	set tIP to do shell script "ifconfig en0|grep 'inet '|cut -d ' ' -f 2"
	if (tIP as text) is not equal to "<ip address of my MBA>" then
		tell application "MapDrives" to quit
	end if
end run

4) Get Specified servers
5)Connect to servers


What I also need to check if the drives are already mapped then not to proceed with the script?
 
Last edited:

aspacelot

macrumors newbie
Feb 11, 2013
4
0
Any Luck?

Hi All

What i am trying to achieve is to map external drives from my NAS only when my MBA is connected on a specific SSID

I found few scripts that check the SSID and I have the relevant applescript. There is a variable you can use with automator but this is only to display the IP and not the current SSID.

The way I have it so far is (Automator application is called MapDrives):

automator:
1) pause 7 seconds
2)Get value of variable (IP)
3)Run Applescript below (the script needs tweaking)

Code:
on run {input, parameters}
	set tIP to do shell script "ifconfig en0|grep 'inet '|cut -d ' ' -f 2"
	if (tIP as text) is not equal to "<ip address of my MBA>" then
		tell application "MapDrives" to quit
	end if
end run

4) Get Specified servers
5)Connect to servers


What I also need to check if the drives are already mapped then not to proceed with the script?


You have any luck on this yet? This is EXACTLY what i'm looking for. Additionally, I'd like to be able to leave my MBA set to get ip via DHCP everywhere except when I'm on network with SSID _____.
 

Sayer

macrumors 6502a
Jan 4, 2002
981
0
Austin, TX
In the Network control panel you can create a "Location" based on the current settings. I believe you can get the behavior you want by simply making a new location when connected to a specific SSID.

I am not sure how you can trigger other things when that SSID becomes available, which is done by triggering the particular "Location" setting(s). If your script runs itself it can check the location and only do its work when needed.

Google "AppleScript Locations" for samples.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.