Once there was an addon that would replace the spell behind a button based on certain conditions.
Users could provide templates for that addon for specific specs.
What was the name of that mod? Cannot figure it out.
Replacing the macro of a button while infight is prohibited I guess?
The best that I came across for now is:
http://wow.curseforge.com/addons/rotation-builder/