PicketFence Posted September 26, 2007 Share 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 Link to comment Share on other sites More sharing options...
Siao Posted September 26, 2007 Share 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" Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now