** Disclaimer, the below post will only be useful if you're building Flash/Flex in Eclipse, on an intel Mac OSX **

So I haven't been posting because I've been busy with the doing. This new job is cool and all but it's also really hard work, not least because I'm completely new to the Eclipse development method. Of course I'm learning lots and will share, I promise.

Yesterday afternoons amazing discover can't go without sharing so I'm going to kick off with that.

It stems from laziness on my part, I was fed up of hitting my Ant build in Eclipse then having to manually switch to my browser (Safari - can't live without that activity panel), then empty it's cache (APPLE - ALT - E), then refreshing the page (APPLE - R), then bring TraceLogger to focus and then finally bring Safari back to focus so I can see if the 1 line of code I changed made any difference.

Now all I have to do is hit my Ant build and it does all of the above for me.

So you're probably wondering how to can I shave seconds off my day? Well the below 3 easy steps will help you on the way to streamlined nirvana:

1) Open up Automator, we need to set up 5 actions to get out job done,

て「 Action 1 is a Finder action called "Launch Application", double click it or drag it to the right workflow panel. This presents you with a combo box, select other and navigate to your browser of choice.

て「 Action 2 is a Safari action called "Get Specified URLs" this is where you put the location of webserver or virtual host. I have a virtual host set up for each project so all I have to do is go to "http://clientsname/" however we want to kill out cache so instead we set our URL to "http://clientsname/index.html?refresh=true" the added query string forces the browser to refresh and saves us from another keystroke.

て「 Action 3 is another Safari action "Display Webpages" because Action 2 only gets the URL it doesn't actually tell the browser to go to it.

て「 Action 4 is another "Launch Application" this time TraceLogger which shows all my trace calls.

て「 Action 5 is the final "Launch Application" to bring Safari back to focus allowing for instant interaction.

So after those 5 steps you workflow should look like the screengrab below.

2) Save out the Automator workflow as a stand-a-lone Application. This is an important step, it needs to be an Application for Ant to be able to call it. I saved my initial trial version in my deploy directory for ease of location but you could put it anywhere.

3) Setting up Ant to find the correct file to launch. OSX goes a bit funky at this point, similarly to the structure of Dashboard widgets Automator Applications are actually just a folder with some files in it, if you try and get Ant to call the "Application" (which is just a folder) it will throw an error. To get round this you need to locate the actual application, it will be in the following folder

automator_application_name.app/Contents/MacOS/automator_application_name.

So your Ant exec should look like this:

XML:
  1. <exec executable="/Users/jolyonruss/Documents/workspaces/client_name/deploy/launch_app.app/Contents/MacOS/launch_app" />

drop that into your Ant build file, no other parameters needed. If you wanted to you could tidy it up and externalise the path to a properties file, but for a quick and dirty solution this works.

That's it. Hit build in Eclipse and sit back and relax :-)

Comments welcome.

Socialise this post, find out more about the Socializer plugin for WordPress.

One Response to “Eclipse to browser quicker with Automator”  

  1. 1 FlashGen.Com .: blog :. » A quick Eclipse OS X Automator tip


Leave a Reply