Quote Originally Posted by 'Zuri',index.php?page=Thread&postID=98663#post9866 3
You should be able to create a macro like:

/stopcasting
/run CloseAllBags(); CloseTradeSkill(); CloseCraft(); CloseItemText();

There are a number of other API calls you could use, check http://www.wowwiki.com/World_of_Warcraft_API for them.
*tag*