Jump to content
spuuunit

Subscript used on non-accessible variable

Recommended Posts

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

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

Since WinGetClientSize() returns an array in case of success, you could also check the variable with IsArray

 


Musashi-C64.png

"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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...