Actions > Write to File > breaking line / placing ENTER

line-break
writetofile

#1

Hello Guys!
I was trying different methods, but still cannot break line when entering text into a file using Write to File action. I would like to create a log file that is appended in each bot’s execution and naturally I would like to have each log to be placed in new line. Do you have any ideas?


#2

@marcin.kubica,

please post your sample recording here


#3

Here is the recording sample:


#4

It seems that I found good solution. I used Java symbol for Enter in the end of the line.

Unix and modern Mac’s: LF (\n)
Windows: CR LF (\r\n)
Older Macintosh Systems: CR (\r)


#5

Hi,
It sounds simple enough but I cant get this work. what is the exact string that you use for this?

I tried (\r\n) , \r\n , ({\r\n}) , @{\r\n} with no luck.
I also tried 0D and 13 for ascii and hex with a combination of () and {} and I cant get it to work.
Im trying to do a line break after “got time value”.

Capture


#6

@eaguirreepjIJX There is an issue in the current version with using line break in Write to file. We’ll fix it for future versions.


#7

Thanks for the reply.
Im currently using notepad with keystrokes but the typing is slow. Is there a way to make the typing speed faster?


#8

Just for others reference.
A workaround that I found would be to put a character after each string like an “@” symbol.
Before the bot finishes running, use the read file module to store all the text from the .txt file into a string.
Use the split string module to separate all strings by the character given. in this case “@”. and put into a list variable
Use the join strings modules to join the items on that list variable and separate elements by line break from the drop down menu.
Lastly, overwrite the .txt file using the write to file module with the variable containing the joint string from the step above.
It is 4 additional modules at the end of the code that seem to get the job done fine.


RPA Express 1.4.0 is rolled out!
How do I append to file with new line in 1.3.0?
#9

Yes, this works. Thanks for a workaround till we fix this issue.


#10

Hi @ashapkina,

Please include BOT execution in windows locked mode. This would help a lot in saving automation hours.

Thanks,
Narendra


#11

@narendra_purTG We are developing a feature that would unlock the PC and execute the script - see more info here Running RPA on a system locked mode


#12

Hi,

I just upgraded to v1.4 and the above worked but I tried one more workaround (for my case more convenient).
I created

  • a file and put the new line character in (i.e. press enter when editing with notepad and save)
  • a variable to use as the newline(i.e. temp_nl).
    In the begging of the recording I read that file with “Read File” and save the file content in variable temp_nl.
    When I need to write a new line with “Write to File” I replace the \r\n (used in older versions) with the variable ${temp_nl}

New line in log file
#13

@dimitriuZHkTsR Works great :+1: Thanks!


#14

Hi Team,

I have created log file (.txt). In that I want to write 3 sentences line by line. But in 1.4 version its not working.

Please give me help how to type sentences line by line.

Note: Earlier version i.e 1.2 version I have tried it .using \r\n and its working. \r\n is used for next line.

Is there another way or command for type into next line?


#15

Amol, you can find workarounds for this issue above in this thread.


#16

Hi colleagues,
There is one more workaround.
In your recording you may create one String variable “br” supposed to contain breaking symbol. Then you may print it to a file or join with other strings were ever line break is needed.
The simplest way to populate “br” by breaking symbol I found is to use “Join Strings” action (just 1 action). There you will join empty “br” with “br”, choose “Windows line break (CR+LF)” as a separator and put result back to “br”. As a result only windows line break will be placed to “br”.

workaround_breake_lines