Hobbyist Posted June 9, 2015 Posted June 9, 2015 Here is what I have:;CSV file has 9 columns, one of which is blank in the middle of the data set. Columns have a header row.; Number of rows is not known at time of reading file.;End result is to add the file via the array to the ListView without column heading or element count from the array.What I am getting is an array with element count and header from CSV file. And of course its ending up in the Listview.I used an example I found on the site and changed it a bit(as commented) to get to where I thought it would work.I need help in understanding what I am doing wrong or even suggestions on how to do it better/correctly.Thanks in advance for helpHobbyist.$Myfile2= "C:\Backyard Dig Bush\American\Analysis\tree.csv" $csv = FileRead($Myfile2) ;$csv = StringStripWS($csv, 7) ; I commented this out as there is a BLANK field in the middle of the data set in each line , so "white space" was an issue, I think. $rows = StringSplit($csv, @CRLF,1) ;used the "1" to eliminate the double spacing per help section , as @CRLF caused a double spacing. Dim $aLogBush[$rows[0] + 1][9] $aLogBush[1][0] = $rows[0] For $i = 0 To $rows[0] $temp = StringSplit($rows[$i], ",", 2) For $j = 0 To UBound($temp) - 1 $aLogBush[$i][$j] = $temp[$j] Next Next _ArrayDisplay($aLogBush) _GUICtrlListView_AddArray($List500, $aLogBush)
MikahS Posted June 9, 2015 Posted June 9, 2015 Can you post the creation of the listview, and give us an idea of how you would like it to look. I understand you don't want the header or count? Is this for your listview or the _ArrayDisplay you are doing of the Array? The more information the better. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ
Moderators Melba23 Posted June 9, 2015 Moderators Posted June 9, 2015 Hobbyist,Using this file:Col 0,Col 1,Col21,Col 3,Col 4,Col 5,Col 6,Col 7,Col 8 Data 00,Data 01,Data 02,Data 03,,Data 05,Data 06,Data 07,Data 08 Data 10,Data 11,Data 12,Data 13,,Data 15,Data 16,Data 17,Data 18I would create the ListView like this:expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <GUIListView.au3> #include <Array.au3> #include <File.au3> ; Read csv file into array Local $aArray _FileReadToArray ("Data.csv", $aArray, $FRTA_COUNT, ",") ; Create GUI $hGUI = GUICreate("Test", 600, 500) ; Create ListView $cLV = GUICtrlCreateListView("", 10, 10, 580, 300) ; Add columns (count is in the array) For $i = 0 To $aArray[0][1] - 1 _GUICtrlListView_AddColumn($cLV, $aArray[1][$i], 60) Next ; Remove the count and header rows _ArrayDelete($aArray, "0;1") ; Add data _GUICtrlListView_AddArray($cLV, $aArray) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndPlease ask if you have any questions.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
Hobbyist Posted June 9, 2015 Author Posted June 9, 2015 Thanks M231And yes - QUESTIONS....I did a copy and paste of your code (which is sleeker than mine) to see it in action and LEARN something.I also saved your data set and then also used mine.I got the following errorswarning:$FTRA_COUNT;possibly used before declaration.error: _FileReadToArray() called with wrong number of args.error: $FRTA_COUNT:undeclared global variable. I definitely want to see yours in action, as it is something I have not seen before. What could be the source of the errors?Using:SciTEVersion 3.4.1 Mar 30 2014 21:57:28 Thanks and sorry for being a pain on this.Hobbyist
iamtheky Posted June 9, 2015 Posted June 9, 2015 (edited) https://www.autoitscript.com/autoit3/docs/libfunctions/_FileReadToArray.htmreplace it with the magic number 1 for now and I would suppose the constants (or magic strings) are in a newer file.au3 than the one you are including so you should hit alt-i and see what arguments differ in your file and/or just install the lastest version and screw troubleshooting. Edited June 9, 2015 by boththose - issues ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Hobbyist Posted June 10, 2015 Author Posted June 10, 2015 boththose Iam really new at this stuff. What are you referring to when you say "install latest version" ? SciTE? file.au3?
iamtheky Posted June 10, 2015 Posted June 10, 2015 (edited) you will get all the latest include files with latest version of autoit. SciTE version matters very little when troubleshooting. Edited June 10, 2015 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Hobbyist Posted June 10, 2015 Author Posted June 10, 2015 OK - I'll try that.One last newbie question if you don't mind. Backward compatibility. Although the little things I coded so far are for my learning purposes, I wouldn't want to lose their functionality or whatever you call it. Thanks
iamtheky Posted June 10, 2015 Posted June 10, 2015 no worries, most changes are small, like an additional parameter. So while they are script breaking, they are not terribly difficult to modify. And you can always keep the old versions of autoit to compile legacy scripts rather than update them. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Hobbyist Posted June 11, 2015 Author Posted June 11, 2015 boththoseIf I may ask another question before it veers off topic too far...I did go to the home page and download the latest version, as per your suggestion.I am hestitant to do such because of potential problems and I am NO expert in this stuff to begin with.Any way, downloaded it and installed it on a laptop rather than my desktop because I didn't want to lose what IS working now.On the laptop, installation says successful, but when running Autoit or SCE I get the following error"The procedure entry point DecoderPointer could not be located in the dynamic link library Kernell32.dll."Huh!?Laptop runs XP (yes its old but I keep it around) versus my desktop running Vista. I did not have any issues with installation of the version I have been running.
iamtheky Posted June 11, 2015 Posted June 11, 2015 I have never experienced that issue. I would post a new topic as that is a different, much more catastrophic issue, and the people you want answering that thread are probably not reading this one. ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
Moderators Melba23 Posted June 11, 2015 Moderators Posted June 11, 2015 Hobbyist,Minimum OS requirements are now Windows XP SP3You say the laptop is old - is it at least SP3?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
Hobbyist Posted June 11, 2015 Author Posted June 11, 2015 M23 & boththose I am so sorry for my last question. I just did some research on the error message and see its the SP3 issue.I was going down the very cautious road of installing the newer Autoit. Thanks again for your patience and knowledge. Hobbyist
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