Tiger Dashboard Widgets, and Automator
I watch Saturday Night Live regularly, and I like to know if it's new or a repeat. This seemed like a good use for a Tiger Dashboard widget.
I took a look at another widget and couldn't believe how simple they are to implement. A widget is just an HTML file, a CSS file, a JavaScript file, and some glue. All you really need is the HTML file, so you can create a widget with no code at all.
I wanted a widget that has what's on http://www.saturdaynightlive.com as the text on the widget. I was thinking of various ways I could pull the HTML and parse it to extract what I wanted to show, when I remembered Tiger has this new thing called Automator.
Automator lets you string together script style operations using a fancy GUI. Every application that exposes Automator tasks is listed in the GUI with all the tasks they support, and each task says what it accepts and what it outputs.
I strung together four things:
- Get Specified URLs (fetches the URL)
- Get Text from Webpage (turns the URL into a text stream)
- Filter Paragraphs (returns just the paragraph I want)
- New Text File (saves it to a text file)
So without having to write any script at all, I have a way of extracting the text I want from the page and saving it into a text file. It was a simple operation from there to get the text from the file and load it (using JavaScript) into the widget.
Automator looks incredibly powerful, and very easy to get into. If you've got Tiger, spend some time playing with it.