Baffling failure of move app to built-in display macro

I typically use my MacBook attached to a dock that connects it to an external display. My display setup includes the built-in display and the external display as a single Space. I always want my email program (MailMate) to appear on the built-in display, never on the external display. But the KM macro I've created to ensure this doesn't work the first time the app is launched (after login or wake), when the app appears on the external monitor and stays there until the macro is triggered again. The problem isn't with the body of the macro, which works on subsequent runs, but appears to be with the macro triggers. For some reason the triggers don't seem to register in some situations.

To work around this, I've tried putting variations on the macro in various places: not just in the KM folder for my mail app, but in the app launchers folder, and in the Global Macro Group. But nothing seems to work.

Here's my current macro setup for moving the app. If you can suggest what might be going wrong, I'd receive it gratefully. Hopefully, it's just a failure of logic on my part that I can learn from.

(Once again, the steps to move the app work correctly, because when manually run, they work flawlessly. The problem only occurs when the app launches, either via KM or via a non-KM method.)

Global Macro Group (available in all applications):

Triggered by any of the following:

-At System Unlock
-At System Wake
-At Login
-Application “MailMate” launches
-The Display Layout Changed

Will execute the following actions:

If All Conditions Met

-The calculation “SCREENCOUNT() > 1” returns true (non-zero)
-Application “MailMate” is running

Execute the Following Actions:

-Move and Resize Front Window
In MailMate
To: (664,1692, 1680,1050)
Notify on failure.
Otherwise, Execute the Following Actions:

-Move and Resize Front Window
In MailMate

To: (SCREENVISIBLE(Main,Left),SCREENVISIBLE(Main,Top), SCREENVISIBLE(Main,Width),SCREENVISIBLE(Main,Height))

Notify on failure.

It's probably trying to move the window before the window has appeared -- you can test that by putting a long "Pause" at the start of the macro.

If that doesn't help then please upload your actual macro (you'll find instructions at How to Post/Upload your Macros and Scripts) so people can take a proper look -- there's lots of action options that don't show up in your listing that may be important.