automator automatically connect to folder/server on wifi connection

I'd like to know if it is possible to create a service or application on Automator that automatically connects to a server / external volume when I get connected to a wifi.


I use my macbook pro both at work and on my house and it would be great if there is a way that automatically connects to an external drive when I get in my office and to my apple Extreme drive when I get in my house.


I don't want to use other software, I'd like to know if it is possible to solve this using Automator


Thanks

Johnny

MacBook Pro (13-inch Early 2011), OS X Mavericks (10.9.1)

Posted on Jan 22, 2014 8:51 AM

Reply
6 replies

Jan 22, 2014 8:54 AM in response to Johnny79m

  1. Launch Automator.
  2. Choose Application from the new document dialog.
  3. In the search field enter pause.
  4. Drag the pause action from the results to the right pane.
  5. Enter 10 seconds to slightly delay the connection attempt to ensure your network connection (wi-fi or otherwise) is ready.
  6. Do a search for server in the search field.
  7. Now drag Get Specified Servers and Connect to Servers (in that order) to the right pane.
  8. In the Get Specified Servers dialogue click Add... and select or enter the address to your network drive. Click OK.
  9. Disconnect from your network drive (eject it), and click Run in Automator to test it. Your network drive should connect after a 10 second delay.
  10. Now save your application.

Feb 19, 2014 6:07 AM in response to Johnny79m

In time I evetually handled this by creating a different user. One for work and one for home. I added things I need for both accounts (iTunes library, iPhoto library, etc...) to the Shared users folder.Then I was able to add the Automator application I created in the Login Items for it's respective account. This kept my work and home stuff separate aside from a few shared items in the shared user folder.


But here is what I initailly did:

Open AppleScript Editor (/Applications/Utilities) > New Document.

Copy and past the script below:


set allLocations to {"In Office", "Out of Office"}

set mainlist to the button returned of (display dialog "Choose a Location" buttons allLocations default button "Out of Office")

if (text of mainlist) = "In Office" then

tell application "Automator1" to activate

end if

if (text of mainlist) = "Out of Office" then

tell application "Automator2" to activate

end if


Where Automator1 is the Automator application you created to connect to your work drives and Automator2 is the Automator2 application you created to connect to your home drives.

If you want you can also change the button that is highlighted by default (default button). I had mine set as "Out of Office".


Obviously if you choose you can also change both "in Office" & "Out of Office" to something more suitable to you.


When you are finished: File > Export > name it, select a location to save it (I suggest your Applications folder) and then select Application as the File Format and Save. You can then add this to your Login Items.


This will give you a popup menu when you log in asking if you are "In Office" or "Out of Office". Select one and it will run the appropriate automator application you created.

Feb 22, 2014 2:00 AM in response to Johnny79m

Johnny79m wrote:


Dear Axeman

Thanks a lot for your immediate answer

this is a nice solution but I'd like to know if it is possible to execute it automatically when I get connected to a specific wifi network, so I can do an application for when I connect to my home wifi and another one for my wifi at work.


I'm a little late with my answer, but you should take a look at this (free) app:


http://www.controlplaneapp.com


It allows you to automatically run chosen actions, programs, scripts, settings, ... depending on certain evidence sources (like WiFi, location, ...).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

automator automatically connect to folder/server on wifi connection

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.