Hello Nitemaru,
As far as I can tell (I'm no expert, just curious), all the code that you post here are about windows positioning and swapping. Maybe you should post the entire code to get some help.
You could try to send the full script attached.
Peace!
K.
Connect With Us