# Generating a .txt file to use to import data into another application

**URL:** <https://forum.inductiveautomation.com/t/generating-a-txt-file-to-use-to-import-data-into-another-application/33902>\
**Category:** Ignition\
**Created:** [April 13, 2020, 11:12pm UTC](https://forum.inductiveautomation.com/t/generating-a-txt-file-to-use-to-import-data-into-another-application/33902 "2020-04-13T23:12:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [April 13, 2020, 11:12pm UTC](https://forum.inductiveautomation.com/t/generating-a-txt-file-to-use-to-import-data-into-another-application/33902/1 "2020-04-13T23:12:46Z")

</div>

Hi Guys

I need to interface with a new machine we purchased that I am commissioning.

The method is via a simple text file file.

I manually created a .txt file with 2 lines ('TestAAD.txt) that imports with no issue.  
[TestAAD.txt](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fb319faa512d6abcb996d9d76b4c90e99f8c52d4.txt) (62 Bytes)

I then wrote a script in Ignition on a button press to generate the same file:

```auto
lotId = event.source.parent.getComponent('Text Field').text

data = ''

data = data +'SIL01	' + 'S	' + lotId + '	' + '4207-HSV' + ' ' + str(1) + '\r\n' + 'SIL01	' + 'S	' + lotId + '	' + '91A00S56' + ' ' + str(1)

filename = lotId + ".txt"
filepath = system.file.saveFile(filename)
if filename is not None:
	system.file.writeFile(filepath, data)

```

[TestAAD1.txt](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/6f0ae24cff8c5856719d0e0f61d874a3fd7c0ca1.txt) (62 Bytes)  
The files look identical to me but the latter does not work.

Anyone have any ideas?

---

<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:** [April 13, 2020, 11:37pm UTC](https://forum.inductiveautomation.com/t/generating-a-txt-file-to-use-to-import-data-into-another-application/33902/2 "2020-04-13T23:37:02Z")

</div>

One of those files begins with `SILO` and the other `SIL0` (letter ‘O’ versus number 0).

---

<div class="post-metadata">

**Author:** ![dion.botha](https://avatars.discourse-cdn.com/v4/letter/d/46a35a/32.png) [@dion.botha](https://forum.inductiveautomation.com/u/dion.botha)\
**Post date:** [April 14, 2020, 2:15pm UTC](https://forum.inductiveautomation.com/t/generating-a-txt-file-to-use-to-import-data-into-another-application/33902/3 "2020-04-14T14:15:35Z")

</div>

Wow, I am so annoyed with myself, I owe you, thank you so much Kevin!
