soundsgood
04-03-2009, 03:21 AM
Hello All,
I'm having serious problems trying to do something most of you will probably find simple,
The end result I am trying to achieve is to read a text file to table or string, take the text from an input, find the row in the text file matching the input text and display the whole row in a paragraph box.
Here is what I have so far, I am a more or less total noob, and this is probable rubbish but I have been trying for days.
nMac = Input.GetText("Input1")
tFileContents = TextFile.ReadToTable("AutoPlay\\Docs\\master-data-file.txt")
for nMac in tFileContents do
count = Table.Count(tFileContents)
for loop = 1, count do
result = String.Find(tFileContents[loop], nMac, 1, false);
if result ~= -1 then
result1 = Table.Remove(tFileContents, loop, result);
Paragraph.SetText("Paragraph1", result1);
end
end
end
if result ~= 0 then
Paragraph.SetText("Paragraph1" , "Not Yet Registered");
end
What I'm getting is that it kind of works then throws me an error at the end that String.Find(tFileContents[loop], is wrong........
and I have simply run out of ideas
Thankyou
J
I'm having serious problems trying to do something most of you will probably find simple,
The end result I am trying to achieve is to read a text file to table or string, take the text from an input, find the row in the text file matching the input text and display the whole row in a paragraph box.
Here is what I have so far, I am a more or less total noob, and this is probable rubbish but I have been trying for days.
nMac = Input.GetText("Input1")
tFileContents = TextFile.ReadToTable("AutoPlay\\Docs\\master-data-file.txt")
for nMac in tFileContents do
count = Table.Count(tFileContents)
for loop = 1, count do
result = String.Find(tFileContents[loop], nMac, 1, false);
if result ~= -1 then
result1 = Table.Remove(tFileContents, loop, result);
Paragraph.SetText("Paragraph1", result1);
end
end
end
if result ~= 0 then
Paragraph.SetText("Paragraph1" , "Not Yet Registered");
end
What I'm getting is that it kind of works then throws me an error at the end that String.Find(tFileContents[loop], is wrong........
and I have simply run out of ideas
Thankyou
J