You could use this:
viewtopic.php?f=172&t=609 to always have your game as the active window or you can set triggers to start/stop your macro. That way if you accidentally click on a different window, you can hit your "stop" trigger, click on your game, and hit the "start" trigger to restart it.
There's other more complicated ways to do it. You can script BEM to get the active window name, if the active window matches your game (the intended macro destination), then begin macro (if not, do nothing until the game becomes the active window).
You could use this: http://www.blueeye-macro.com/viewtopic.php?f=172&t=609 to always have your game as the active window or you can set triggers to start/stop your macro. That way if you accidentally click on a different window, you can hit your "stop" trigger, click on your game, and hit the "start" trigger to restart it.
There's other more complicated ways to do it. You can script BEM to get the active window name, if the active window matches your game (the intended macro destination), then begin macro (if not, do nothing until the game becomes the active window).