# Write a tag to a txt file

**URL:** <https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576>\
**Category:** Ignition\
**Created:** [June 16, 2014, 8:19pm UTC](https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576 "2014-06-16T20:19:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![controlsim](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@controlsim](https://forum.inductiveautomation.com/u/controlsim)\
**Post date:** [June 16, 2014, 8:19pm UTC](https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576/1 "2014-06-16T20:19:44Z")

</div>

Hello, I wonder if is possible to write a line break every time I write to a txt file

with this code I get the following

`data = event.source.parent.getComponent('turno1').text
filename = system.file.saveFile("MyDownloadedFile.txt")
if filename != None:
   system.file.writeFile(filename, data,1)`  
[attachment=0]1.png[/attachment]

But I want something like this  
[attachment=1]2.png[/attachment]

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 16, 2014, 8:24pm UTC](https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576/2 "2014-06-16T20:24:28Z")

</div>

Sure, just append a newline character to data before you write it…

```auto
data = event.source.parent.getComponent('turno1').text + '\n'
```

---

<div class="post-metadata">

**Author:** ![controlsim](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@controlsim](https://forum.inductiveautomation.com/u/controlsim)\
**Post date:** [June 16, 2014, 8:48pm UTC](https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576/3 "2014-06-16T20:48:43Z")

</div>

Its not working with “notepad” but works with “wordpad”, It is possible to do this with notepad?

notepad:  
[attachment=0]notas.png[/attachment]

wordpad:  
[attachment=1]wordpad.png[/attachment]

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [June 16, 2014, 8:50pm UTC](https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576/4 "2014-06-16T20:50:55Z")

</div>

Maybe you need to write a carriage return before the linefeed for notepad to pick it up… use ‘\r\n’ instead.

---

<div class="post-metadata">

**Author:** ![controlsim](https://avatars.discourse-cdn.com/v4/letter/c/47e85d/32.png) [@controlsim](https://forum.inductiveautomation.com/u/controlsim)\
**Post date:** [June 16, 2014, 8:54pm UTC](https://forum.inductiveautomation.com/t/write-a-tag-to-a-txt-file/8576/5 "2014-06-16T20:54:00Z")

</div>

Thanks Keevin, That worked!
