Hammerspoon is a desktop automation tool for OS X. It bridges various system level APIs into a Lua scripting engine, allowing you to have powerful effects on your system by writing Lua scripts.
another ff automation tool
Chickenfoot for Firefox: Rewrite the Web