EddCase Posted January 30, 2023 Posted January 30, 2023 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.
Solution Danp2 Posted January 30, 2023 Solution Posted January 30, 2023 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 Latest Webdriver UDF Release Webdriver Wiki FAQs
EddCase Posted January 30, 2023 Author Posted January 30, 2023 Thank you so simple, I just couldn't see it. Thanks again.
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