Limagito Filemover Software Blog and News

November 19, 2019

Pascal Script, Creating a text file

Dear users,

Simple Pascal Script to create a txt file containing the files handled by our file mover.

1 Add PS as Destination

2. Add the following Pascal Script. Don’t forget to adjust the ctOutputPath and ctOutputFilename.

Var
  tmpList: TStringList;
  tmpFile: String;
Const
  ctOutputPath = 'C:\Test\Out\';
  ctOutputFilename = 'Info.txt';
Begin
  psExitCode:= 1;
  // Init Var
  tmpFile := ctOutputPath + ctOutputFilename;
 
  tmpList := TStringList.Create;
  Try
    psLogWrite(1, '', 'Add ' + psfilePath + psFileName + ' to ' + tmpFile);
    If FileExists(tmpFile) Then
      tmpList.LoadFromFile(tmpFile);
    tmpList.Append(psFilePath + psFilename);
    tmpList.SaveToFile(tmpFile);
  Finally
    tmpList.Free;
  End;
End.

Regards,
Pascal

By Limagito Pascal Script , Share: