Autom8 your connections

Mac Automator

UPDATE : 10/10/2012 8:00am : Apparently I have no idea what I’m doing :-/  I built the tutorial as I was building the scripts. These did not actually work at the end of the day or the next morning.  Working on determining why.

UPDATE : 10/10/2012 8:45am : So I figured out these do indeed work, however, my Automator Launcher process was wedged, and these three scripts were just sitting there, not doing anything.  I found this by running Activity Monitor and looking at the processes.  I killed off my scripts and the launcher process, and now they work.

I’m lazy.  If I can write a program or script to do something to save me time, I’ll do it. Especially when I have to do something over and over and over. Take for example connecting to servers every morning when you log in, or disconnecting them when you leave at night.  I have a MacBookPro and I repeatedly connect and disconnect to various places on campus.  I also have a fire-wire drive that is my Time Machine backup.  If you’ve used a Mac, you know you get ‘yelled at’ if you simply unplug it without properly dismounting it.

When you have 4-5 servers connected and external devices connected, that’s a lot of wasted time even just ejecting them when you want to leave. So I started a quest to save me time (even if its just 2 minutes a day, it adds up, right?).

Enter Automator.  This is a special utility on Mac that lets you build a set of steps and run it.  These can be as simple or as complex as you want.   Here is what I wanted to accomplish –

  • connect to my 5 servers at 7:30 (when I’m typically at my desk)
  • disconnect from those servers at 4:50 (when I’m ready to leave)
  • disconnect from my fire-wire drive at 4:50 (since this auto-mounts when I plug it in in the morning)

Here’s what I did –

Open Automator (from the Launchpad)

New Application

On the left is a set of action.  Either choose the Files & Folders listing from the Library column, or type in Get Specified Servers.

Drag that from the left onto the right pane like the image below –

Then we want to tell Automator to do the actual connecting to these servers.  Be advised – if you have to log into these servers, and those credentials are not stored in your key ring, it will prompt you to log in to each server.

Now save it.

Create a new iCal Alarm – File | New | iCal Alarm

Find the Launch Application action and drag it over.

Choose ‘other’ from the drop down list and go find where you saved the application above.

Choose the application you built before and click Choose. Along with any other actions  you want. I build a separate application to disconnect my Time Machine drive, and added it below.  Save this and it will prompt for an alarm name –

Once you enter that, iCal will launch and you can then edit the alarm details, such as when time and how often you want this to run – for me we’ll set this to every day @ 7:30am –

Now my computer will connect every morning and save me the headache of doing it myself (I said I was lazy, remember)

So now – at the end of the day – I have to pack up and clean out my coffee pot – so I want the computer to disconnect from all of these things.  Earlier I created a separate application to disconnect from my Time Machine drive, so I could execute that separately if I had to.  I’ll set up a new iCal Alarm to disconnect the servers and my drive at 4:50PM each day  just like we did before.

then save it –

Save iCal Alarm

Then set the time / date in iCal when it opens.

iCal set time and date for automator application run

Now you’re done, and I’m happily lazy.

Code it right
theCodeDog
theCodeDog

posted in Personal by Jonathan

Follow comments via the RSS Feed | Leave a comment | Trackback URL

Leave Your Comment

 
Powered by Wordpress and MySQL. Theme by Shlomi Noach, openark.org