Jump to content

Subscript used on non-accessible variable


 Share

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.

Link to comment
Share on other sites

  • Developers

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.
  :)

Link to comment
Share on other sites

  • Developers
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.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...