This is a link to the source code of the mymacros plugin for The Bat! That plugin does nothing else but export macros. My programming days are long over, but I think you guys can use the source to figure out how to export the requested macros ;D

Peter