I don't use FF so I do not know what imacros can do. KM has a MacroLanguage
http://kmeleon.sourceforge.net/wiki/MacroLanguage2. With it you can have KM do a great many things. There are examples at the K-Meleon Macro Library
http://kmeleon.sourceforge.net/wiki/MacroLibrary and the K-Meleon Extensions Central
http://kmext.sourceforge.net/ has extensions which also use the MacroLanguage.