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

Thread Tools Search this Thread Display Modes
Old Oct 20, 2012, 07:02 PM   #1
macrumors member
Join Date: Jun 2012
Applescript and Automator Mix

Hi All

What I am trying to achieve is to map certain drives one my MBA is either connected to wireless with ip : or connected via vpn with ip Automator script is called "MapDrives"

I am using automator and applescript for this. So far it seems to be working but I would like to know if there is a more efficient way of doing this


Automator steps
1)Pause for 7 seconds (until wireless is up)
2)Run Applescript

global Local_IP
global VPN_IP

on run {input, parameters}
	set Local_IP to do shell script "ifconfig en0|grep 'inet '|cut -d ' ' -f 2"
	set VPN_IP to do shell script "ifconfig tun0|grep 'inet '|cut -d ' ' -f 2"
	if (Local_IP as text) is equal to "" or (VPN_IP as text) is equal to "" then
		tell application "MapDrives" to quit
	end if
end run
3)Get Specific servers

smb://<NAS ip>/<folder A>
smb://<NAS ip>/<folder B>
4)Connect to servers

Also is there a way for the script to automatically run once either of the ip has change?

anton1s is offline   0 Reply With Quote

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
Can't stop an Applescript with Automator Niouky Mac Programming 18 Apr 20, 2014 02:46 AM
Automator and/or AppleScript Help jbsmithmac Mac Programming 6 May 5, 2013 04:02 PM
Automator / Applescript > copy to folder mynameismatt89 Mac Programming 2 Feb 6, 2013 04:32 PM
Automator and/or Applescript Help downingp Mac Programming 2 Oct 24, 2012 07:35 PM
Convert Automator Flow to AppleScript?? CyXBeAtZ Mac Programming 6 Sep 5, 2012 11:35 PM

Forum Jump

All times are GMT -5. The time now is 03:27 PM.

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

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