(imported topic written by gbabbitt91)
I found an earlier post that shows how to parse through a file and change a particualr line in that file.
// store the file location
parameter "filename" = "c:\somefile.ini"
// iterate through the file replacing lines as necessary
appendfile {concatenation "%0d%0a" of ( if (it starts with "Username=") then (preceding text of first "Username=" of it) & "Username=" & (name of current user) else it ) of lines of file(parameter "filename")}
This works great but what I would like to do is modify this example so that it adds a new line to the ini file before the line containing “Username=” Im not quite sure how get the newline added. Appreciate the help
thanks
Greg