No announcement yet.

Updating a text file

  • Filter
  • Time
  • Show
Clear All
new posts

  • Updating a text file

    This isn't a request for code. We have been using Setup Factory for years and, outside of the small section of code that changes yearly due regulatory items, my scripts haven't changed in years. I have forgotten much of what I once knew in this case.

    So what I need to know:
    I have a text file that controls the order of how the data is presented to the user. In this case, I need to add "Rook (Walrus).xxx" as the very first line to this file. Is this possible from within Setup Factory without a helper program? As far as I can tell, it isn't.

  • #2
    It is possible.TextFile.ReadToTable(), add line at the beginning, then use TextFile.WriteFromTable() to write the new file. Or read current content with TextFile.ReadToString(), then write the first line of the new file, and use TextFile.WriteFromString(sFilename, sPreviousText, true) to append the old text after the new initial line.