spuuunit 0 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. Share this post Link to post Share on other sites
Jos 2,165 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. Share this post Link to post Share on other sites
spuuunit 0 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? Share this post Link to post Share on other sites
spuuunit 0 Posted October 25, 2020 Oh wait I think I got it now! Thank you for your help! 😄 Share this post Link to post Share on other sites
Jos 2,165 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. Share this post Link to post Share on other sites
Musashi 307 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." Share this post Link to post Share on other sites
JockoDundee 118 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... Share this post Link to post Share on other sites