Can I run a script in the background? (Apple script editor)
No, System Events can only send keystrokes to the frontmost window and is not capable of sending keystrokes to a window  that's in the background.