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

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 (62 Bytes)

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

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 (62 Bytes)
The files look identical to me but the latter does not work.

Anyone have any ideas?

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

1 Like

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