Contents of InputFile.txt:
Now read the file in and write it back out to file to confirm FileRead and FileAppend are working properly:
Code: Select all
FileRead , OutputFileContents , InputFile.txt
FileDelete , OutputFileContents.txt
FileAppend , %OutputFileContents% , OutputFileContents.txt
Good ✓
Now write a concatenated string to a file using FileAppend, to confirm FileAppend works properly with concatenated strings:
Code: Select all
Loop 3
OutputString .= "String line " . A_Index . "`n"
FileDelete , OutputString.txt
FileAppend , %OutputString% , OutputString.txt
Good ✓
Now concatenate the string with the file contents, and write that to file:
Code: Select all
OutputFilePlusString := OutputFileContents . "`n" . OutputString
FileDelete , OutputFilePlusString.txt
FileAppend , %OutputFilePlusString% , OutputFilePlusString.txt
✕ Wrong
For some reason it has only appended line feed instead of carriage return + line feed.
I noticed this after finding Ahk2Exe specifically writes line feed only (without carriage return) to the output executable.