PicketFence 0 Posted September 26, 2007 Im trying to get a script to not execute a portion of code if the desktop is in active focus. I have used the following code with no luck. Any help is greatly appreciated. Thank you! For this example if notepad.exe was executed, it should focus on the Untitled window and hide it. It should then set the focus back to the previous application unless the desktop was the current active window. WinWaitActive("Untitled -") WinSetState("Untitled -", "", @SW_HIDE) If Not WinActive("Program Manager", "") Then Send("{ALT DOWN}") Send("{TAB}") Send("{ALT UP}") EndIf Share this post Link to post Share on other sites
Siao 6 Posted September 26, 2007 (edited) WinActive("Program Manager", "") method works fine. As for your code snippet, keep in mind that even after you hide that Notepad window, it's still active. To make desktop active you'd have to click on it. Therefore your code always executes ALT-TAB. Edited September 26, 2007 by Siao "be smart, drink your wine" Share this post Link to post Share on other sites