Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 1, 2012, 03:32 AM   #1
anton1s
macrumors member
 
Join Date: Jun 2012
HOW TO: map drives if on correct SSID

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 by anton1s; Sep 1, 2012 at 06:29 AM. Reason: update automator script
anton1s is offline   0 Reply With Quote
Old Feb 11, 2013, 11:41 PM   #2
aspacelot
macrumors newbie
 
Join Date: Feb 2013
Any Luck?

Quote:
Originally Posted by anton1s View Post
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 _____.
aspacelot is offline   0 Reply With Quote
Old Feb 12, 2013, 02:17 PM   #3
Sayer
macrumors 6502a
 
Sayer's Avatar
 
Join Date: Jan 2002
Location: 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.
__________________
Obama is a true statesman whose experience as a state senator, half-term US Senator & guest lecturer in a Constitutional Law class has fully prepared him to take control of our nuclear arsenal.-Me
Sayer is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Unknown Network SSID showing theslaz Mac Peripherals 6 Dec 22, 2013 08:17 AM
New Map App BLANK in Map View MagnusVonMagnum OS X Mavericks (10.9) 6 Nov 8, 2013 03:43 PM
naming external drives, hard drives, thum drives for best compatability Sossity Mac Peripherals 1 Apr 5, 2013 03:11 AM
Google Map or Apple Map? Henry Li iOS 6 129 Sep 23, 2012 09:29 AM
Map Speedo, A cool map + speedometer askpi iPhone and iPod touch Apps 0 Jun 15, 2012 07:33 PM

Forum Jump

All times are GMT -5. The time now is 06:01 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC