Announcement

Collapse
No announcement yet.

TextFile.WriteFromString help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TextFile.WriteFromString help

    Hi all,

    Been using setup factory 9 for a while now but i have been trying some new stuff and got a bit stuck.

    I'm trying to write to a text file which works but i also need to write a variable to the file as well but that part fails, here's the code i'm using
    Code:
    TextFile.WriteFromString("%AppFolder%\\test.cfg", "Title=product\r\nFolder=%AppFolder%\r\n", true);
    %AppFolder% = C:\testfolder
    The file is created where i want but contains
    Code:
    Title=product
    Folder=%AppFolder%
    instead of
    Code:
    Title=product
    Folder=C:\testfolder
    Any help appreciated

  • #2
    You may want to read how to use Session Variables properly.

    Ulrich

    Comment


    • #3
      Thanks for the pointer i got it working now.
      Here's the code i used incase it helps anyone else.
      Code:
      TextFile.WriteFromString("%AppFolder%\\test.cfg", "Title=product\r\nFolder="..SessionVar.Expand("%AppFolder%").."\r\n", true);

      Comment


      • #4
        You probably need to expand the first %AppFolder% as well, or your path will be wrong.

        Ulrich

        Comment

        Working...
        X