Conditional script

Hi there!
Is it possible in Max using scripting to switch certain functions on under certain conditions. For example I have some keyboard shortcuts set up for unwrap UVW and I always forget to switch on overide keyboard shortcuts when it's open. I also forget to switch it off after I've used it.

So what I'm asking is it possible to determine if the unwrap UVW window is set as the focus and therefore switch on overide keyboard shortcuts and switch it off when it's not in use.

Cheers