Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2005
    Posts
    5

    Removing line from text file??

    I'm new in AutoPlayMedia Studio6, so if somebody would like to help me how can I remove one specific line from the text file. I now first 10 characters from specific line.
    Regards.

  2. #2
    Join Date
    Oct 2005
    Location
    MI
    Posts
    524
    This should get you started... you'll probably want to add some error checking after the text file reads and writes.

    Code:
    -- Declare the location of your text file and the sting you are looking for
    g_MyTextFile = "C:\\mytextfile.txt"
    g_SearchString = "abcdefg"
    
    -- Setup an empty table to hold the contents of your text file
    t_TextFile = {};
    
    -- Read the contents of your text file to the table (See help file for more info)
    t_TextFile = TextFile.ReadToTable(g_MyTextFile);
    
    -- Step through each line in the table looking for your culprit and del any that match 
    local index;
    local line;
    for index, line in t_TextFile do
         if String.Find(line, g_SearchString, 1, true) == 1 then
              Table.Remove(t_TextFile, index);
         end
    end
    
    -- Write the results back to your text file
    TextFile.WriteFromTable(g_MyTextFile, t_TextFile, false);
    Yeah right. Who's the only one here who knows the illegal ninja moves from the government?

    ()))))))))o)))))))==============================================

  3. #3
    Join Date
    May 2005
    Posts
    5
    Thank you very much. I think that I now understand how it works.
    Rado

Similar Threads

  1. Get a line out of a text file
    By StealthShadow in forum Setup Factory 7.0
    Replies: 3
    Last Post: 10-28-2005, 04:56 PM
  2. Example: Loading Paragraph Text Using a Timer
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 7
    Last Post: 11-25-2004, 05:10 PM
  3. Writing Text to a File
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-22-2003, 02:02 PM
  4. Action: Text File - Find Line
    By pjborg in forum AutoPlay Media Studio 4.0
    Replies: 1
    Last Post: 06-07-2003, 05:10 AM
  5. Replies: 0
    Last Post: 08-17-2000, 02:29 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