How to run a keyboard macro with automator in a background application?
It cannot be done, afaik.

Only the frontmost app will accept keypresses.

I don't have an absolute reference to confirm this, but there are discussion at Apple Communities, Stack Overflow &amp; MacScripter that would appear to agree with my belief.