Determine Which Monitor and Then Move Window to Another Monitor

I want to create a toggle situation with my Main monitor and my external monitor. When I press the hotkey, I want the macro to test to see if the window is on the Main monitor. If it is, then I want it to move the window to the external monitor, else move the window back to the Main monitor.

I constructed and If Then Else macro and attempted to use the variable condition "screen = 0" to test if the window was on the main monitor. However, that doesn't seem to be firing.

How can I test to see if the window is on the Main monitor?

This macro by @peternlewis should show you how to do this:
Move window to next screen, and maintain its position

Thanks. The problem is that I want the hotkey to act as a toggle. I need a way to reference the current monitor. If the window is on monitor 1, I want to move it to monitor 2. If it's on monitor 2, I want to move it to monitor 1.

I thought this would be possible with the screen variable. For example,

if screen = 0
then move the window to screen 1
move the window to screen 0

However that doesn't work.

Did you test the macro? That is exactly what it does.

No, I didn't. (Duh.) I was trying to understand the logic. When I tested it, it worked like a charm. Awesome!