wisem2540 Posted February 5, 2015 Share Posted February 5, 2015 (edited) I know this is not efficient, but I do not know how to fix it. The file should always have 11 columns, but the number of lines will change. Currently the file is over 6,000 lines, and 813k in file size My Current process is to read the file into a 1D aray, then split each CSV like into seperate elements. It takes about 1min to complete, which is too long for the GUI I want to build. #include <array.au3> #include <file.au3> Dim $oneDarray _FileReadToArray("C:\file.csv", $oneDarray) Local $Array[0][11] For $x = 1 to $OneDArray[0] _ArrayAdd ($Array,$OneDArray[$x],0,",") ;MsgBox (0, "", @Error) Next _ArrayDisplay ($Array) Edited February 5, 2015 by wisem2540 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2015 Moderators Share Posted February 5, 2015 (edited) wisem2540,The _FileReadToArray function in the latest Beta versions will read your file directly into a 2D array. M23 Edited February 5, 2015 by Melba23 Wrote the wrong function name! 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...
Solution MikahS Posted February 5, 2015 Solution Share Posted February 5, 2015 (edited) Why not try out: #include <File.au3> _FileReadToArray("C:\file.csv", $oneDarray, 1, ",") ? Edited February 5, 2015 by MikahS 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 Link to comment Share on other sites More sharing options...
MikahS Posted February 5, 2015 Share Posted February 5, 2015 (edited) wisem2540, The _FileListToArray function in the latest Beta versions will read your file directly into a 2D array. M23 That will only list files and folders in an array, not the contents of the file. EDIT: Unless the beta version has this capability, if so disregard this. Edited February 5, 2015 by MikahS 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2015 Moderators Share Posted February 5, 2015 MikahS,Brain failure! 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...
wisem2540 Posted February 5, 2015 Author Share Posted February 5, 2015 Why not try out: #include <File.au3> _FileReadToArray("C:\file.csv", $oneDarray, 1, ",") ? I thought this would work too, but when I do an _Arraydisplay, nothing happened. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2015 Moderators Share Posted February 5, 2015 wisem2540,How about posting a copy of the file so we can test? 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...
wisem2540 Posted February 5, 2015 Author Share Posted February 5, 2015 I am using autoit 3.3.12. I will upgrade based on M23's suggestion and see how it goes.... Link to comment Share on other sites More sharing options...
wisem2540 Posted February 5, 2015 Author Share Posted February 5, 2015 wisem2540, How about posting a copy of the file so we can test? M23 Sure, Ill need to take some data out of it first... gimmie a sec Link to comment Share on other sites More sharing options...
MikahS Posted February 5, 2015 Share Posted February 5, 2015 I thought this would work too, but when I do an _Arraydisplay, nothing happened. Try this: _FileReadToArray("C:\file.csv", $oneDarray, 2, ",") Brain failure! I know I have my moments! yay, for old age! 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 Link to comment Share on other sites More sharing options...
MikahS Posted February 5, 2015 Share Posted February 5, 2015 I am using autoit 3.3.12. I will upgrade based on M23's suggestion and see how it goes.... see post #5 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 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 5, 2015 Moderators Share Posted February 5, 2015 MikahS,The Beta _FileReadToArray does indeed have the required functionality - I just wrote the wrong function name. 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...
wisem2540 Posted February 5, 2015 Author Share Posted February 5, 2015 Mikah, Your original solution worked...my Array was just the wrong size. Thanks for the help. I misinterpreted the meaning of the help file. My mistake. Link to comment Share on other sites More sharing options...
MikahS Posted February 5, 2015 Share Posted February 5, 2015 MikahS, The Beta _FileReadToArray does indeed have the required functionality - I just wrote the wrong function name. M23 Good deal, thank you for clarifying Melba. Mikah, Your original solution worked...my Array was just the wrong size. Thanks for the help. I misinterpreted the meaning of the help file. My mistake. Glad to have helped. 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 Link to comment Share on other sites More sharing options...
wisem2540 Posted February 5, 2015 Author Share Posted February 5, 2015 Actually, after more testing, I had one weird characters in one of the columns. When I edited the file to post for you guys, it masked the issue. Anyway, still fixed Link to comment Share on other sites More sharing options...
MikahS Posted February 5, 2015 Share Posted February 5, 2015 Actually, after more testing, I had one weird characters in one of the columns. When I edited the file to post for you guys, it masked the issue. Anyway, still fixed No problem, if you have anymore questions relating to reading the file contents into an array post here, otherwise you can start a new topic if you hit anymore snags. 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 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