inov8iv Posted January 15, 2009 Share Posted January 15, 2009 (edited) I have a program I wrote and am having an issue with it writing an extra Carriage Return at the end of the document. For processing I cannot have this extra CR at the end. It puts the CR after however many rows of 9's it needs. Any help is greatly appreciated. ;--------CODE SNIPPET-------- FileWriteLine($ACHFile, $FLine1) FileWriteLine($ACHFile, $FLine2) If StringRight($TLines4, 1) = 1 Then $FLCount = 9 If StringRight($TLines4, 1) = 2 Then $FLCount = 8 If StringRight($TLines4, 1) = 3 Then $FLCount = 7 If StringRight($TLines4, 1) = 4 Then $FLCount = 6 If StringRight($TLines4, 1) = 5 Then $FLCount = 5 If StringRight($TLines4, 1) = 6 Then $FLCount = 4 If StringRight($TLines4, 1) = 7 Then $FLCount = 3 If StringRight($TLines4, 1) = 8 Then $FLCount = 2 If StringRight($TLines4, 1) = 9 Then $FLCount = 1 $FLine3 = "9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999" $FLC = 0 While $FLC <> $FLCount FileWriteLine($ACHFile, $FLine3) $FLC = $FLC + 1 WEnd FileClose($ACHFile) ;------------------------------------------ Thank you, inov8iv Edited January 15, 2009 by inov8iv Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2009 Moderators Share Posted January 15, 2009 Good morning,As you are only concerned about the last line of the file, try using FileWrite rather then FileWriteLine.From the Help file:FileWriteLine - "If the line does NOT end in @CR or @LF then a DOS linefeed (@CRLF) will be automatically added."FileWrite - "The line is written as is - no @CR or @LF characters are added."That should solve your problem.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...
inov8iv Posted January 15, 2009 Author Share Posted January 15, 2009 Changing the FileWriteLine to FileWrite did not work. As you can see in the script, I am using the $FLine3(rows of 9's) to finish the footing for my file. they have to be in columnar format. I am going to test the file with the extra linebreak at the end and see if it works. You solution sounded good, but I think it would create to much extra coding for me to make it work. Anyone else have any ideas? Thank you, Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 15, 2009 Moderators Share Posted January 15, 2009 inov8iv, Why not change the While...WEnd to a For...Next, but leave it one short:For $FLC = 0 To $FLCount - 2 FileWriteLine($ACHFile, $FLine3) Next FileWrite($ACHFile, $FLine3) That way you get the @CRLF for everything but the last line. 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...
inov8iv Posted January 15, 2009 Author Share Posted January 15, 2009 inov8iv, Why not change the While...WEnd to a For...Next, but leave it one short:For $FLC = 0 To $FLCount - 2 FileWriteLine($ACHFile, $FLine3) Next FileWrite($ACHFile, $FLine3) That way you get the @CRLF for everything but the last line. M23I did something similar, but may change it to your way to make it simplier. $FLC = 1 While $FLC < $FLCount FileWriteLine($ACHFile, $FLine3) $FLC = $FLC + 1 WEnd While $FLC = $FLCount FileWrite($ACHFile, $FLine3) $FLC = $FLC + 1 WEnd Thanks for your help people. inov8iv 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