simy8891 Posted May 27, 2014 Posted May 27, 2014 Hi guys, me again. So I've got this 2D array with about 6200 items in it (4 columns). It seems that FileWrite, FileWriteLine, _FileWriteLine and _FileWriteFromArray all stop at line 5278 (size 199KB). I'm writing to a .csv with a For cycle. Any thoughts? Thanks
JohnOne Posted May 27, 2014 Posted May 27, 2014 Any thoughts? Post your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
simy8891 Posted May 27, 2014 Author Posted May 27, 2014 (edited) John, there's really not much, see below, this is the last test I made with just FileWrite, but as I said, I tried with FileWriteLine, _FileWriteToLine: Local $hFileOpen = FileOpen($destination_file,$FO_OVERWRITE) FileWrite($hFileOpen,"Name,Disabled,Last Logon,Description"&@CRLF) For $i=1 To $CompleteArray[0][0] FileWrite($hFileOpen,$CompleteArray[$i][0]&','&$CompleteArray[$i][1]&','&$CompleteArray[$i][2]&','&$CompleteArray[$i][3]&@CRLF) Next FileClose($hFileOpen) And same problem happens with this (which is the first thing I tried): _FileWriteFromArray($destination_file,$CompleteArray,1,Default,",") Obviously, _arrayDisplay() shows me all of the 6200 lines. EDIT: I tested the below, which works fine for all 100000 lines! It doesn't make any sense to me to be honest! Local $hFileOpen = FileOpen($destination_file,$FO_OVERWRITE) For $i=1 to 100000 FileWriteLine($hFileOpen,"Name,Disabled,Last Logon,Description"&@CRLF) Next FileClose($hFileOpen) Thanks Edited May 27, 2014 by simy8891
Moderators Melba23 Posted May 27, 2014 Moderators Posted May 27, 2014 simy8891,I have just run this and got all 6200 lines into the file:#include <Array.au3> #include <File.au3> $destination_file = "File.txt" Global $CompleteArray[6201][4] = [[6200]] For $i = 1 To 6200 For $j = 0 To 3 $CompleteArray[$i][$j] = $i & "-" & $j Next Next $hFileOpen = FileOpen($destination_file,$FO_OVERWRITE) FileWrite($hFileOpen,"Name,Disabled,Last Logon,Description"&@CRLF) For $i=1 To $CompleteArray[0][0] FileWrite($hFileOpen,$CompleteArray[$i][0]&','&$CompleteArray[$i][1]&','&$CompleteArray[$i][2]&','&$CompleteArray[$i][3]&@CRLF) Next FileClose($hFileOpen) Global $aLines _FileReadToArray($destination_file, $aLines) _ArrayDisplay($aLines, "", Default, 8)Can you try and see if you get the same result. 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
simy8891 Posted May 27, 2014 Author Posted May 27, 2014 (edited) Hi Melba23, yup, it worked. So did my quick test: Local $hFileOpen = FileOpen($destination_file,$FO_OVERWRITE) For $i=1 to 100000 FileWriteLine($hFileOpen,"Name,Disabled,Last Logon,Description"&@CRLF) Next FileClose($hFileOpen) Just to show you that I checked, this is the _arrayDisplay() of the array I have: and the end: Is there something else I could try? Cheers Edited May 27, 2014 by simy8891
Moderators Melba23 Posted May 27, 2014 Moderators Posted May 27, 2014 simy8891,Is there any chance that the array might hold an EOF marker? Then when you read the file it would seem to stop early. I suggest using ConsoleWrite to check that you are actually writing all 6200 lines and using Binary to look at the actual bytes written:For $i = 1 To $CompleteArray[0][0] $sLine = $CompleteArray[$i][0] & ',' & $CompleteArray[$i][1] & ',' & $CompleteArray[$i][2] & ',' & $CompleteArray[$i][3] FileWrite($hFileOpen, $sLine & @CRLF) ConsoleWrite($i & ": " & $sLine & @CRLF & Binary($sLine) & @CRLF) NextThen when you see the file is truncated, look at the line in question and see if the binary content gives us a clue. 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
simy8891 Posted May 27, 2014 Author Posted May 27, 2014 Ehmmm guys.. I found the problem.. it's called in part Excel 2013 and in part a System Eng. who doesn't know how to end a sentence! When editing the .csv file with Notepad++ for instance, I can see them all. But I went on the actual line where it stopped, I've noticed (in N++) that there's was a quote " sign in the description. I went to check in AD (this is exported from AD) and the description didn't match, BUT, it ended with a "," rather than with nothing or with a ".". Anyway, I removed the comment in AD and it went just fine.. for now Thanks
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