EddCase Posted January 30 Share Posted January 30 Hi, I have a task that I need to be running, I'd like it to be running hidden. Essentially What I'd like to do is if its hidden show it and If its showing hide it. I've got this and it works but there's got to be a better way Opt ("WinTitleMatchMode", 2) $State = WinGetState ("authserver.exe") $Win = WinExists ("authserver.exe") MsgBox (0, "Win " & $win, "State " & $State) If $State = 7 Then WinSetState ("authserver.exe", "", @SW_HIDE) ElseIf $State = 23 Then WinSetState ("authserver.exe", "", @SW_HIDE) ElseIf $State = 39 Then WinSetState ("authserver.exe", "", @SW_HIDE) ElseIf $State = 5 Then WinSetState ("authserver.exe", "", @SW_SHOW) ElseIf $State = 21 Then WinSetState ("authserver.exe", "", @SW_SHOW) ElseIf $State = 37 Then WinSetState ("authserver.exe", "", @SW_SHOW) EndIf I'm sure I'm going to be missing states using my code. Please any help would be greatly appreciated. Link to comment Share on other sites More sharing options...
Solution Danp2 Posted January 30 Solution Share Posted January 30 Use BitAnd to determine if the window is visible -- If BitAnd($State, $WIN_STATE_VISIBLE) Then WinSetState ("authserver.exe", "", @SW_HIDE) Else WinSetState ("authserver.exe", "", @SW_SHOW) EndIf EddCase 1 WebDriver UDF [GH&S] Latest version Wiki FAQs Link to comment Share on other sites More sharing options...
EddCase Posted January 30 Author Share Posted January 30 Thank you so simple, I just couldn't see it. Thanks again. 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