slybry70 Posted February 16, 2021 Share Posted February 16, 2021 Hello all, I am having complications with arrays. I am new to arrays and still trying to wrap my head around them. Couple of notes about the script I am creating. This script is used to input either a single computer name or multiple computer names and remove information pertaining to those computer names in a certain application. The section of the program for removing a single computer names information is working decent. The section of the code that pertains to removing the information for multiple PC's is not working currently. Line that errors out is 232-Getting Incorrect subscript or subscript dimension range exceeded In the script I have the code open excel. Then input a list of computer names in the first column. Lines 210 to 213 show me that it is indeed pulling a single dimension array and I can even display it using array display. I think I am originally pulling the information using the Excel UDF commands and wondering if the error is because I am trying to use that array it created to display in a listview? Thank you for any input 🙂 ComputerDecommLV.au3 Link to comment Share on other sites More sharing options...
Nine Posted February 16, 2021 Share Posted February 16, 2021 I believe you would need to use : For $iIncrement = 0 to $aMax - 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
slybry70 Posted February 16, 2021 Author Share Posted February 16, 2021 I made that change: For $iIncrement = 0 to $aMax - 1 Its still showing that there is an error with the next line. 232-$aResult[$iIncrement][0] = "PC:" & $iIncrement . Showed no change in the error. For a single dimension array shouldn't there be just one [ ]? Link to comment Share on other sites More sharing options...
Nine Posted February 16, 2021 Share Posted February 16, 2021 9 minutes ago, slybry70 said: shouldn't there be just one [ ]? yes “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
slybry70 Posted February 16, 2021 Author Share Posted February 16, 2021 With this change " For $iIncrement = 0 to $aMax -1 $aResult[$iIncrement] = "PC:" & $iIncrement ; This is not working. Getting a incorrect subscript or subscript dimension range exceeded. Next " I get a GUILISTVIEW error. I got the $aResult from a Excel UDF command that created the array. Can you use that information in a listview without converting it into another array? Link to comment Share on other sites More sharing options...
Zedna Posted February 16, 2021 Share Posted February 16, 2021 (edited) Use _ArrayDisplay($aResult,'Title') to check content/dimensions of $aResult. Also look at UBound() Edited February 16, 2021 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
slybry70 Posted February 16, 2021 Author Share Posted February 16, 2021 I am aware of how to make it display using arraydisplay. I did successfully get it working but I do not like the GUI of arraydisplay or working with it. Listview seems better and other posters on the forums said they recommend using listview and not Excel UDF. So pulling the array with $aResult = _Excel_RangeRead($oWorkbook, Default, $oWorkbook.ActiveSheet.Usedrange.Columns("A:A"), 2) You cannot enter it into a listview? Link to comment Share on other sites More sharing options...
slybry70 Posted February 16, 2021 Author Share Posted February 16, 2021 Also already looked at the dimension with Local $iDimension = UBound($aResult, $UBOUND_DIMENSIONS). Line 211. Link to comment Share on other sites More sharing options...
slybry70 Posted February 18, 2021 Author Share Posted February 18, 2021 Looks like since no one knows if excel UDF arrays and listview are compatible I will stick with the excel UDF arraydisplay and try to work with that view...... Link to comment Share on other sites More sharing options...
Nine Posted February 18, 2021 Share Posted February 18, 2021 8 minutes ago, slybry70 said: Looks like since no one knows if excel UDF arrays and listview are compatible Sorry but we know that it is compatible, but you would need to make a smaller replicate of the issue you are facing. Your current code is not runable for us and it is way too large for my personal laziness to investigate. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
TheXman Posted February 18, 2021 Share Posted February 18, 2021 (edited) On 2/16/2021 at 10:25 AM, slybry70 said: I am having complications with arrays. I am new to arrays and still trying to wrap my head around them. On 2/16/2021 at 10:25 AM, slybry70 said: Thank you for any input Let's be honest, you may be new to arrays but you appear to new to several other AutoIt scripting-related subjects. Your script, as it currently stands, is a bit of a mess. There's no wonder why others may not be eager to try to help at this point. You have way more issues with this script than your issue with arrays. If you have the full version of Scite4Autoit3 installed and you add the following line to the top of your script and hit CTRL+F5, you will see NUMEROUS issues in the console such as: (Although they are warnings, some of those warnings could possibly cause serious logic issues and errors. I didn't dig deep enough to know how serious all of the warnings are in your script) #AutoIt3Wrapper_AU3Check_Parameters=-w 3 -w 4 -w 5 -w 6 -d 'Local' specifier in global scope A mixture of declared & undeclared variables. Several variables that are declared multiple times within the same function. Global variable defined inside a function. And I don' know how you came up with this snippet of code. First you define a Global Excel object (inside a function), then immediately redefine the same object locally, and then 2 lines below that, you define the same object again. Func ExcelEntriesFunc() Global $oExcel = _Excel_Open() ;Create an Excel Object Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookNew($oExcel, 1) Local $oExcel = ObjGet("", "Excel.Application") ; Get an existing Excel Object If @error Then MsgBox(0, "ExcelTest", "Error Getting an active Excel Object. Error code: " & Hex(@error, 8)) Exit EndIf Plus your limited use of @error/return checking has given you a false sense that your script was successful in places that it obviously wasn't. There are more issues but I think you get my point. If I were handed this script to get running, the first thing I would do is clean it up by removing any warnings, correcting any scope-related issues, and adding much more @error/return checking to make sure that the most important lines of code executed successfully before trying to continuing thru the script. Then I would go line by line through the logic to make sure that it was doing exactly what it needed to do when it needed to do it. Edited February 18, 2021 by TheXman CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
slybry70 Posted February 22, 2021 Author Share Posted February 22, 2021 Thank you for the constructive reply first of all. I was not aware of the ctrl F5 with the line added to the script would show in verbose errors. It helps alot in the long run. I am new to scripting in general and right now just barely limping along. Purchased a book online but no courses on Autoit are out there and almost no education book wise. I figured it would be obvious I am not a scripting expert let alone an AutoIT expert. I included my whole script in the posting because that is what normally is requested by those that help out on the forums. In the past I have gotten some nice and informative help on these forums so I hope that in the future that continues. I am grateful for your look at the script and will go through it again with this new error information. Thank you for taking the time to look at it TheXMan! TheXman 1 Link to comment Share on other sites More sharing options...
Zedna Posted February 22, 2021 Share Posted February 22, 2021 There is no need for AutoIt's book, just read AutoIt's HelpFile Resources UDF ResourcesEx UDF AutoIt Forum Search 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