trescon Posted April 2, 2013 Share Posted April 2, 2013 Hi, I have a little problem of inexperience with Autoit.Then I have a. Csv file that I have read and assign to the array. (yes, I know it is not a. standard csv)The first thing I did was:_FileReadToArray ("C:\AutoIt\Progetti\Giacenze\Archivi_Miei\oggi.csv",$pippo) the file is made up of 4/500 lines like the following:004100;031555;14;1;2,9000;20130329004100;031556;4;;;20130329 004100;031557;4;;;20130329004100;032187;1;;;20130329004100;032249;3;;;20130329I then I Pravato printing to the console what I've read, it's fine but I can not break down all the changes separated by ";" in as many variables in an array.for $i = 0 to UBound($pippo)-1 $pluto=StringSplit($pippo,";") for $t= 1 to 6 $minni[$i][$t]=$pluto[$t] next $t ConsoleWrite ($i & " - " & $pippo[$i] & " +++ " & $pluto&@CRLF)NextBut I do not decompose anything. What could be wrong.Sorry for my low level.thanksAlbertoItalian :Salve, io ho un problemino di inesperienza con Autoit.Allora ho un file .csv che devo leggere e assegnare a degli array. (si lo so non è un .csv standard)La prima cosa che ho fatto è stata :_FileReadToArray ("C:\AutoIt\Progetti\Giacenze\Archivi_Miei\oggi.csv",$pippo)il file è composta da 4/500 linee come le seguenti :004100;031555;14;1;2,9000;20130329004100;031556;4;;;20130329 004100;031557;4;;;20130329004100;032187;1;;;20130329004100;032249;3;;;20130329Io poi ho pravato a stampare sulla console quello che ho letto, tutto bene ma non riesco a scomporre tutti i cambi separati da ";" in altrettante variabili di un array.for $i = 0 to UBound($pippo)-1 $pluto=StringSplit($pippo,";") for $t= 1 to 6 $minni[$i][$t]=$pluto[$t] next $t ConsoleWrite ($i & " - " & $pippo[$i] & " +++ " & $pluto&@CRLF)NextMa non mi scompone nulla. Dove sbaglio.Scusate per il mio basso livello.Grazie Thank You Alberto --------------------------------------------------- I am translate with Google. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2, 2013 Moderators Share Posted April 2, 2013 trescon,You cannot use ConsoleWrite directly on an array: ConsoleWrite ($i & " - " & $pippo[$i] & " +++ " & $pluto & @CRLF) - you need to break out each element like this: #include <File.au3> #include <Array.au3> ; Just for display Local $Pippo _FileReadToArray("Test.txt", $Pippo) _ArrayDisplay($Pippo) ; Just for display For $i = 0 To UBound($Pippo) - 1 ConsoleWrite($i & " - " & $Pippo[$i] & @CRLF) $Pluto = StringSplit($Pippo[$i], ";") For $t = 1 To $Pluto[0] ConsoleWrite($Pluto[$t] & " - ") Next ConsoleWrite(@CRLF) NextAll clear? M23P.S. If you are going to add Italian translations to all of your posts, please put them in spoilers like this:You do this by enclosing the text in [spoiler][/spoiler]. That way the rest of us do nto have to see them. Grazie. 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...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 Ok, but my problem is that the content of each line I must decompose to assign to a variable array put him on trial later, not only displayed immediately. thanks PS: ok for the spoiler Thank You Alberto --------------------------------------------------- I am translate with Google. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 2, 2013 Moderators Share Posted April 2, 2013 trescon, You need to create another array of the correct size and fill it as you go along: #include <File.au3> #include <Array.au3> Local $Pippo _FileReadToArray("Test.txt", $Pippo) _ArrayDisplay($Pippo) Local $Minni[UBound($Pippo)][6] For $i = 1 To UBound($Pippo) - 1 $Pluto = StringSplit($Pippo[$i], ";") For $t = 1 To $Pluto[0] $Minni[$i][$t - 1] = $Pluto[$t] Next _ArrayDisplay($Minni, "After " & $i) Next _ArrayDisplay($Minni, "Final") Is that better? 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...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 Yes, that's much better. Now I have to try to understand how it works and how to make the most of your example. thanks P.S. how do I inseire / activate the spoiler, the list of options not find it. Thank You Alberto --------------------------------------------------- I am translate with Google. Link to comment Share on other sites More sharing options...
FireFox Posted April 2, 2013 Share Posted April 2, 2013 (edited) P.S. how do I inseire / activate the spoiler, the list of options not find it. Between the rubber and the Font combobox you have "Special BBCode" and winthin you will find "Spoiler" but you can directly write damn, how did Melba23 to show the code tags? with your text inside Br, FireFox. Edited April 2, 2013 by FireFox Link to comment Share on other sites More sharing options...
trescon Posted April 2, 2013 Author Share Posted April 2, 2013 Between the rubber and the Font combobox you have "Special BBCode" and winthin you will find "Spoiler" but you can directly write damn, how did Melba23 to show the code tags? with your text inside Br, FireFox. Thanks, found it. I was looking for as a command visible ..... Thank You Alberto --------------------------------------------------- I am translate with Google. 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