spuuunit Posted October 25, 2020 Posted October 25, 2020 This is my code: While 1 While WinActive("PicTor - ") AND NOT WinActive("PicTor - Microsoft Visual Studio") ; PicTor $pos = WinGetPos("[ACTIVE]") $size = WinGetClientSize("[ACTIVE]") If $pos[0] = 0 AND $pos[1] = 0 AND $size[0] = 1920 AND $size[1] = 1080 Then ; do something EndIf Sleep(10) WEnd Sleep(10) WEnd I get this error message sometimes when loosing focus off the "PicTor" window. When minimizing "PicTor" for example. I don't understand why... Why can't the script access $size[0]? I just declared it.
Developers Jos Posted October 25, 2020 Developers Posted October 25, 2020 Check the Helpfile for WinGetClientSize() and see what it return when not found and you have your answer. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
spuuunit Posted October 25, 2020 Author Posted October 25, 2020 Oh thanks. It says sets the @error flag to non-zero if the window is not found. What does non-zero mean?
spuuunit Posted October 25, 2020 Author Posted October 25, 2020 Oh wait I think I got it now! Thank you for your help! 😄
Developers Jos Posted October 25, 2020 Developers Posted October 25, 2020 2 minutes ago, spuuunit said: What does non-zero mean? @error <> 0 So test for success as you really always need to do! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Musashi Posted October 25, 2020 Posted October 25, 2020 Since WinGetClientSize() returns an array in case of success, you could also check the variable with IsArray "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
JockoDundee Posted October 26, 2020 Posted October 26, 2020 1 hour ago, Musashi said: Since WinGetClientSize() returns an array in case of success, you could also check the variable with IsArray I do it like this: $size=WinGetClientSize("[ACTIVE]") If $size<>0 And $size[0]=1920 AND $size[1]=1080 Then ... Code hard, but don’t hard code...
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