seePyou Posted September 30, 2015 Share Posted September 30, 2015 My code is this: Func GetAllSystemIDfiles($SysIdArray) Local $ShortSysIdArray = _ArrayUnique($SysIdArray, 1, 0) ;shorten the array from the 1000 entries to just the ones found. _ArrayDisplay($ShortSysIdArray, "$SysIdArray Before _ArrayPop()") _ArrayPop($ShortSysIdArray) ;remove the last entry which is empty Local $limit = $ShortSysIdArray[0] Local $systemIDtest Local $systemIDworking While UBound($ShortSysIdArray) ;run through all entries - or systemIDs MsgBox(0, '_ArrayPop() return value', _ArrayPop($ShortSysIdArray)) $systemIDtest = _ArrayPop($ShortSysIdArray) MsgBox(64, "Test", $systemIDtest) if $systemIDtest = $limit Then MsgBox(64, "Test Fail", $systemIDworking) Else $systemIDworking = $systemIDtest MsgBox(64, "Process", $systemIDworking) SplashTextOn("Working...","Getting " & $systemIDworking ,200,100) SystemIDGet($systemIDworking) EndIf _ArrayDisplay($ShortSysIdArray, "$SysIdArray AFTER _ArrayPop()") WEnd SplashOff() EndFuncThe error I'm getting is this:"C:\Users\XYZQWERTY\Documents\personal\scripts\SAPscope.au3" (176) : ==> Subscript used on non-accessible variable.:Local $limit = $ShortSysIdArray[0]Local $limit = $ShortSysIdArray^ ERROR>Exit code: 1 Time: 3.5 I really do not understand why that is happening, and I also do NOT see the _ArrayDisplay part of the code, I assume because it is going through the whole of the function. If I comment out the Local $limit line where the error is reported to happen, then I can see the _ArrayDisplay and it results in this:Row|Col 0[0]|2929288193[1]|2929288248[2]|2929288866[3]|2929288867[4]|10361599419[5]|10361599546[6]|10364550010[7]|10364819377[8]|10364826489The display ends at marker 999 The $ShortSysIdArray is supposed to only live in that function as I may want it to work on amny "polls" of different resulting arrays, it is there just to accept the array coming in and work on it. I've even tried it this way:Local $ShortSysIdArray[1000] $ShortSysIdArray = _ArrayUnique($SysIdArray, 1, 0) ;shorten the array from the 1000 entries to just the ones found. _ArrayDisplay($ShortSysIdArray) _ArrayPop($ShortSysIdArray) ;remove the last entry which isempty Local $limit = $ShortSysIdArray[0]andDim $ShortSysIdArray[1000] $ShortSysIdArray = _ArrayUnique($SysIdArray, 1, 0) ;shorten the array from the 1000 entries to just the ones found. _ArrayDisplay($ShortSysIdArray) _ArrayPop($ShortSysIdArray) ;remove the last entry which isempty Local $limit = $ShortSysIdArray[0]Still the same error.So... any thoughts? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2015 Moderators Share Posted September 30, 2015 seePyou,Welcome to the AutoIt forums.The short answer to your question is that $ShortSysIdArray is obviously not an array - which is why _ArrayDisplay does not work and you get an error when you try to access it.So I suggest you add some errorchecking to confirm this - try IsArray or check the @error value after the _ArrayUnique call. What do you get?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 Link to comment Share on other sites More sharing options...
seePyou Posted September 30, 2015 Author Share Posted September 30, 2015 Hi Melba23, thanks for the welcome, I appreciate it On your reply, if what you suspect were true, then the _ArrayDisplay in there would not produce the result it does, am I not right in saying so? That _ArrayDisplay was my check to see that it workedInstead, as I've said, if I comment out the line the compiler complains about, then this code:_ArrayDisplay($ShortSysIdArray, "$SysIdArray Before _ArrayPop()")will happily work and pop up a window with the array contents:Row|Col 0[0]|2929288193[1]|2929288248[2]|2929288866[3]|2929288867[4]|10361599419[5]|10361599546[6]|10364550010[7]|10364819377[8]|10364826489The display ends at marker 999 One more thing: I checked with a friend, I sent him my code, he has AutoIT 3.3.8.1, but I recently went to 3.3.14.1. He can run the code without issue. Maybe this can explain things? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2015 Moderators Share Posted September 30, 2015 seePyou,Hang on, you said:I also do NOT see the _ArrayDisplay part of the codand yet now you say you do. Which is it?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 Link to comment Share on other sites More sharing options...
seePyou Posted September 30, 2015 Author Share Posted September 30, 2015 (edited) if I run the code as I've writen it, then the error occurs without me having seen the _ArrayDisplay. I assume that this is because the compiler FIRST goes through the WHOLE of the function and checks it out, in essence only checking it and NOT running it.but if I comment out the line that offends the compiler, then the code will happily move on and the _ArrayDisplay command will be executed. Maybe I messed the description a little too much with introducing the fact that I don't see the _ArrayDisplay if I don't remove the offending line. How about this new description then?"My code errors out with this error message:"C:\Users\XYZQWERTY\Documents\personal\scripts\SAPscope.au3" (176) : ==> Subscript used on non-accessible variable.:Local $limit = $ShortSysIdArray[0]Local $limit = $ShortSysIdArray^ ERROR>Exit code: 1 Time: 3.5If I comment out this line, then my code works. Since I can see the _ArrayDisplay when the code works, I assume that the $ShortSysIDArray is infact an array, so why would it have a problem being addressed as an array with a [0] ? Edited September 30, 2015 by seePyou (adding more clarity at the end of the post) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2015 Moderators Share Posted September 30, 2015 seePyou,No, the error will only occur at runtime, not compile time, as the compiler has no idea what the variable will contain and only checks for syntax.So let us add some errorchecking and see what we can find. Please amend the beginning of the function to this and let me know what you get displayed:Local $ShortSysIdArray = _ArrayUnique($SysIdArray, 1, 0) ;shorten the array from the 1000 entries to just the ones found. ; Check for _ArrayUnique error MsgBox($MB_SYSTEMMODAL, "Unique", "Error = " & @error) ; Check for array size MsgBox($MB_SYSTEMMODAL, "Array", IsArray($ShortSysIdArray) & @CRLF & UBound($ShortSysIdArray, 0) & @CRLF & UBound($ShortSysIdArray, 1) & @CRLF & UBound($ShortSysIdArray, 2)) ; And display it using "verbose" which tells us if it is not an array _ArrayDisplay($ShortSysIdArray, "$SysIdArray Before _ArrayPop()", Default, 8) _ArrayPop($ShortSysIdArray) ;remove the last entry which is emptyYou will need to add #include <MsgBoxConstants.au3> to the top of your script if it is not already there.I would also suggest upgrading to v3.3.14.2 - there was a nasty bug in _ArrayUnique in 3.3.14.0/1 (for which I take full responsibility) which we have now fixed. As your script uses this function we might as well make sure it works!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 Link to comment Share on other sites More sharing options...
seePyou Posted September 30, 2015 Author Share Posted September 30, 2015 Thank you M23,I'll try upgrading first (because even when I do get to see the array after the _ArrayUnique function, it still produces wrong data, meaning, not the data that running this on 3.3.8.1 gets). Link to comment Share on other sites More sharing options...
seePyou Posted September 30, 2015 Author Share Posted September 30, 2015 OK, first of all, running the same script on 3.3.14.2SAPscope.au3" (179) : ==> Subscript used on non-accessible variable.:Local $limit = $ShortSysIdArray[0]Local $limit = $ShortSysIdArray^ ERROR>Exit code: 1 Time: 4.536So that's not it. As for your modified code:I get a message box titled Unique, and the text is Error = 6, and it has an OK button only.Then I click the OK button and I get another message box, titled Array and it contains 4 0 in a column, like this:0000It also has only an OK button.I press the OK button and I get a window titled "ArrayDsiplay Error $SysIdArray Before _Arra" (I suspect it is just a window width problem, as it should continue with more text in the title - unimportant) and it is a Yes/No window, with the text "No array variable passed to function. Exit the script?"Pressing Yes ends the run. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2015 Moderators Share Posted September 30, 2015 seePyou,I get a message box titled Unique, and the text is Error = 6, and it has an OK button only.I get another message box, titled Array and it contains 4 0 in a columnThat means that you are not getting an array returned from the _ArrayUnique function - and error 6 tells us that is because you are asking it to look at a column that does not exist. In this call:_ArrayUnique($SysIdArray, 1, 0)you are asking it to look in column 1 - so I can only assume that $SysIdArray is a 1D array with only column 0 available. Try changing the $iColumn parameter in that call to 0 and see if that does the trick.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 Link to comment Share on other sites More sharing options...
seePyou Posted September 30, 2015 Author Share Posted September 30, 2015 (edited) what the hell...First of all... you were completely right!Second of all, why is this working in 3.3.8.1 ? Did the definition of _ArrayUnique change between these?I feel stupid now... :S Thank you M23!!! Edited September 30, 2015 by seePyou spelling Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 30, 2015 Moderators Share Posted September 30, 2015 seePyou,I rewrote the Array library for v3.3.12.0 adding 2D support - the changes were set out in the Help file:https://www.autoitscript.com/autoit3/files/beta/autoit/docs/script_breaking_changes_array_udf.htmand you can see at the bottom of the page:_ArrayUnique - For consistency with all other functions $iColumn is now 0-based, not 1-basedwhich explains the difference. Always worth reading the script-breaking changes when you update the AutoIt version - we try to keep them to a minimum, but there are always some "gotchas" hiding in there.Anyway, glad I could help.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 Link to comment Share on other sites More sharing options...
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