I think what you want to do would be crossing the line into _bad_ automation.
Blizzard has a different set of code for things addons can do in combat. These are called secure templates. This gives addons the ability to do some things that they would not normally be able to do using normal wow api outside of combat. These are designed to stop bad automation, but still give some flexibility to what can be done. My guess is that bartender uses those.
http://wowprogramming.com/docs/secure_template
Connect With Us