Hello All,
Is there any parameter to be set so that when I execute WriteLn command and it just writes new lines in file. All the current lines in file will be truncated. By default when I execute WriteLn and it writes new lines below them.
Thank you for your help.
WriteLn Command
Moderators: Dorian (MJT support), JRL
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: WriteLn Command
Just add %CRLF% to the string:
The DeleteFile> command will not throw an error if the file doesn't exist so you can always have that one there if you want to over write an existing file.
Code: Select all
Let>FILE_CONTENTS=this is row 1%CRLF%this is row 2
ConCat>FILE_CONTENTS,%CRLF%this is row 3
DeleteFile>%SCRIPT_DIR%\test.txt
WriteLn>%SCRIPT_DIR%\test.txt,,FILE_CONTENTS
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: WriteLn Command
I re-read your post now. You should open the file in Notepad++ (or similar) and check the files format. It must be windows based for the new line to work properly.
Re: WriteLn Command
Thank you Grovkillen,
Is there anyway to not delete the file? Like C++ ofstream we don't need to delete it
Is there anyway to not delete the file? Like C++ ofstream we don't need to delete it
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: WriteLn Command
Yep, just write to it without the delete file command. It will add a new line at the bottom of the file.
-
- Newbie
- Posts: 19
- Joined: Mon Oct 14, 2019 6:23 am
Re: WriteLn Command
I'm not sure if I understand exactly what you mean, but if you don't want it to include the line break for each WriteLn> you can use:
Code: Select all
Let>WLN_NOCRLF=1
//Do stuff
Let>WLN_NOCRLF=0