Archive for January, 2007

My Thoughts on Automator

Thursday, January 4th, 2007

Automator was introduced with the launch of Mac OS 10.4 (Tiger), so I’m fairly late in discussing it here. However a recent post to my local Mac User Group’s mailing list got me interested. The simple question was “Is it possible to monitor a web page for changes?”.

I’m a big fan of the terminal, so I knocked together a quick shell script to check the page and mail me if anything had changed. I then thought, I’ll just run this every x minutes as a cron task. This would be fine for me, however I then began to think about less technical users- how could I package the script for them? A user on the mailing list had suggested an AppleScript, so I could have rewritten the shell script in AppleScript putting in an infinite loop to allow it to check periodically. I hate AppleScript (I’ll leave that for another post), so that option was immediately out.

Then it struck me- why don’t I create an Automator task for the action?

I had seen the sneaky option for a Shell Script Automator Action:
screenshot.jpg
I thought I’d just sit down, cut and paste my script and be done before dinner…and I was!

The whole experience of creating my own Automator action was great. I referred to the Automator Programming Guide for required information, and surprisingly the whole thing took a little over an hour.

Then Automator’s only weakness became apparent. I searched high and low for a way to repeat workflows periodically. There was none in sight, and I was back to square one. I did come across the third-party Automator Loop Utility which serves the purpose.

In short I like Automator a lot. The ease of development of custom actions is fantastic and the developer’s documentation is well-writen (as always). But I refuse to love Automator until it will repeat my tasks automatically.

Technorati Tags:
, ,

Recursive Word Count in Terminal

Tuesday, January 2nd, 2007

I’ve recently wondered about how to recursively count the number of lines within a series of files within a directory hierarchy. The command that I came up with is:
wc -l `find . -name \*.java -print`
The output is very readable, since it prints both the filename and the number of lines.
Enjoy!

Technorati Tags:
,