Tuesday, August 17, 2010

gmail filter appender with Sikuli

Gmail filters are great, but I've got some filters that apply to a hundred different senders - and I'm always adding new senders to them. I've wished for an automated way to add the sender of the message I'm currently viewing to one of my filters.

I'm sure this could be done in Greasemonkey, Selenium, etc., but Sikuli is my tool of interest for the moment - and, after some fumbling, I'm really happy with it.

A partial screenshot, just to give you the idea:

View the Sikuli code, or download it and run it with /path/to/your/sikuli-ide.sh spammy.skl - except you'll probably want to edit the keywords identifying your filter, and possibly recreate the graphics to match your own Firefox theme. Mostly, it's there as an example to learn from.

I'm learning plenty that will go into my Ohio LinuxFest talk, but the big lesson for today is to rely on keyboard-based and text-based techniques rather than picture-finding whenever they're available. For instance, how should I click a button that might have scrolled off the bottom of the screen? There are lots of ways - I could embed find() in a loop with type(Key.PAGE_DOWN), for example - but it's more reliable to piggyback off Firefox's "Find" to zoom in on the text on (or near) the button and then find it.

No comments: