How to create an application specific macro

As @peternlewis suggested, you can use the Switch Case Action.
I have just uploaded an Action for this, complete with instructions. See:
###ACTION: Switch Case Based on FrontMost App