Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2009
    Posts
    2

    Help for noob desperately needed please

    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

  2. #2
    Join Date
    Nov 2006
    Posts
    233
    Try this...

    Code:
    --get string from input
    nMac = Input.GetText("Input1")
    
    --read file to table
    tFileContents = TextFile.ReadToTable("AutoPlay\\Docs\\master-data-file.txt")
    
    --for loop to run through the table
    for i,v in tFileContents do
    
    --check if the line contains the same as the input field
    nFind = String.Find(tFileContents[i], nMac, 1, false);
    
    	--if nFind is not -1 then it was found and this is the line we want
    	if nFind ~= -1 
    	Paragraph.SetText("Paragraph1", tFileContents[i]);
    	
    	--break out of the loop
    	break;
    	
    	else --line doesnt contain the same info 
    	Paragraph.SetText("Paragraph1" , "Not Yet Registered");
    	
    	
    	end
    		
    end

  3. #3
    Join Date
    Mar 2009
    Posts
    2
    Fantastic,

    Thankyou so much, and for explaining how you did it too

    Thanks again

Similar Threads

  1. My first DLL
    By nrgyzer in forum AutoPlay Media Studio 7.5
    Replies: 3
    Last Post: 01-02-2009, 03:52 AM
  2. Function needed: Registry Set permissions
    By Solmos in forum AutoPlay Media Studio 7.5 Suggestions
    Replies: 2
    Last Post: 03-31-2008, 08:26 AM
  3. Replies: 4
    Last Post: 03-05-2007, 08:23 AM
  4. Not properly installed when update isn't needed?
    By Mortamer in forum TrueUpdate 1.0
    Replies: 3
    Last Post: 03-02-2005, 09:42 AM
  5. A Few Message Translations Needed
    By Darryl in forum Setup Factory 7.0
    Replies: 0
    Last Post: 02-04-2005, 02:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts