Announcement

Collapse
No announcement yet.

Saving file from input

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

  • Saving file from input

    Hello,

    Again, I am having issues. I'm trying to save a file from input as a batch file and write the data from another input. The code below get "error, could not save text file." Any help would be great. Thanks

    Code:
    IP = Input.GetText("ip");
    get = Input.GetText("CMD");
    
    test = "C:\\TSAT\\Map\\"..IP.."-Drive.bat" 
    TextFile.WriteFromString(test, get, false);

  • #2
    Originally posted by Widget View Post
    Hello,

    Again, I am having issues. I'm trying to save a file from input as a batch file and write the data from another input. The code below get "error, could not save text file." Any help would be great. Thanks

    Code:
    IP = Input.GetText("ip");
    get = Input.GetText("CMD");
    
    test = "C:\\TSAT\\Map\\"..IP.."-Drive.bat" 
    TextFile.WriteFromString(test, get, false);
    I do something like this, it reads a text file into a table - gets the data from certain lines in the table (IP=192.167.1.1), then whatever gets typed into the input - gets automatically written back to the file.

    Code:
    file = "AutoPlay\\Docs\\Config\\ftp.txt"
    
    text_contents = TextFile.ReadToTable(file);
    error = Application.GetLastError();
    
    if (error ~= 0) then
        Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
    else
       ip = Input.GetText("stb ip");
       new = "IP=" .. ip
       Table.Remove(text_contents, 1);
       Table.Insert(text_contents, 1, new);
       TextFile.WriteFromTable(file, text_contents, false);
    end

    Comment


    • #3
      That worked - Thanks

      Comment

      Working...
      X