Sign in to follow this  
Followers 0
dotnetfreak

Pop up blocker error

2 posts in this topic

Hi Everyone,

I searched on the forum for this error and found about 3 other members having it but I dont know what is causing it in my case.

The error Im getting is "Subscript used with non-Array variable"

The strange thing is that the script can run for hours (2 or 3) and block the popups ok, but when it has ran for some time it throws that error and I cant see why.

Thanks in advance

Opt("TrayIconHide", 1)

While 1
    KillPopUps()
WEnd

Func IsWindowVisible($handle)
    If BitAnd( WinGetState($handle), 2 ) Then 
        Return 1
    Else
        Return 0
    EndIf
EndFunc

Func Manager()

$WindowsList = WinList()

    For $i = 1 to $WindowsList[0][0]
        $windowsize = WinGetClientSize($WindowsList[$i][1])
        $windowpos = WinGetPos($WindowsList[$i][1])
        
        If $var[$i][0] = "" Then        
                
                If $windowsize[0] = 555 And $windowsize[1] = 234 And IsWindowVisible($WindowsList[$i][1]) Then
                    WinActivate($WindowsList[$i][1])
                    MouseClick("left", 125+$windowpos[0], 240+$windowpos[1], 1, 0)
                EndIf
                
            EndIf
            
        Next
        
    
    Sleep(1000)
EndFunc

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\End User\Desktop\popupblocker.au3"

C:\Documents and Settings\Emilio\Desktop\popupblocker.au3 (33) : ==> Subscript used with non-Array variable.:

If $windowsize[0] = 555 And $windowsize[1] = 234 And IsWindowVisible($WindowsList[$i][1]) Then

If $windowsize^ ERROR

>Exit code: 1 Time: 17169.448

Share this post


Link to post
Share on other sites



dotnetfreak,

It looks as if the WinGetClientSize call is failing - and so you do not have an array as a return.

Simple solution - use IsArray to check that you do have a valid array before proceeding.

Longer term solution - find out why you have a window returned from WinList that then fails with WinGetClientSize . One thing that springs to mind - cancelling a pop-up which takes other windows with it so that a window in the list no longer exists when you come to check it. Perhaps a check with WinExists before trying WinGetClientSize is also necessary?

I know it seems like a lot of error-checking, but that is what you need at times... ;-)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
Sign in to follow this  
Followers 0