# writeFile and Carriage Returns

**URL:** <https://forum.inductiveautomation.com/t/writefile-and-carriage-returns/4884>\
**Category:** General Discussion\
**Created:** [July 25, 2012, 6:21pm UTC](https://forum.inductiveautomation.com/t/writefile-and-carriage-returns/4884 "2012-07-25T18:21:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [July 25, 2012, 6:21pm UTC](https://forum.inductiveautomation.com/t/writefile-and-carriage-returns/4884/1 "2012-07-25T18:21:54Z")

</div>

I’m having trouble getting CR’s to seperate lines in a text file. Here’s what I have:

`def PrintTicket (LineIndex,PartIndex,PrnName):
	import system.file
	TriggerName = "C:\BarTender\TriggerFiles\MoveTicket.dat"
	FormatName = "D:\BarTender\MoveTickets\LabelFormats\MoveTicket.btw"
	LineTxt1 = '%BTW% /AF=' + FormatName + ' /PRN=' + PrnName + ' /R=3 /D=%Trigger File Name% /P /DD \r'
	LineTxt2 = '%END% \r'
	LineTxt3 = '22,2222,82222,123,07/23/2012,9:22AM,1,ZZZZ,3,2121,Stuff,33,Other,44 \r'
	OutputData = LineTxt1 + LineTxt2 + LineTxt3
	system.file.writeFile(TriggerName, OutputData)
`

I’ve tried various combinations of escape () characters like \r, \n,etc. What I get is one long line. Any help would be appreciated.

---

<div class="post-metadata">

**Author:** ![James.Lorenz](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/james.lorenz/32/3290_2.png) [@James.Lorenz](https://forum.inductiveautomation.com/u/James.Lorenz)\
**Post date:** [July 25, 2012, 7:32pm UTC](https://forum.inductiveautomation.com/t/writefile-and-carriage-returns/4884/2 "2012-07-25T19:32:51Z")

</div>

Are you using Windows notepad to view the text file? It appears that notepad needs both (\r\n) to read a newline.

---

<div class="post-metadata">

**Author:** ![WildeKurt](https://avatars.discourse-cdn.com/v4/letter/w/50afbb/32.png) [@WildeKurt](https://forum.inductiveautomation.com/u/WildeKurt)\
**Post date:** [July 25, 2012, 8:20pm UTC](https://forum.inductiveautomation.com/t/writefile-and-carriage-returns/4884/3 "2012-07-25T20:20:21Z")

</div>

You are correct! Thanks.
