Window-switching

simple window switching, like for example Keyclone does it (even if its called pip there) can be done quite easily with using the selfwritten <ResizeAndPosition>-command shown above.
Is there a way to do this if the shift key is held, but undo it when it is released?

I was looking through forums and it seems "SetForeground." is actually what I need. But need it to only work if Shift is held.

Is this possible?