dotnetfreak Posted June 3, 2009 Posted June 3, 2009 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
Moderators Melba23 Posted June 3, 2009 Moderators Posted June 3, 2009 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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