File Mover Blog

March 20, 2018

Pascal Script, generate a file

Q: I want to generate a file which is called “complete” in target folder after all files are moved to target folder.

In this case you’ll need to add 2 Pascal Scripts.
First one ‘One Rule Begin’ script:

Begin
  psExitCode:= 1;
  // … add your code here
  psResetCounter;
End.
Second one ‘On Rule End’ Script (you need to adjust the ctFilePath value in the script):

Var
  tmpFile: TStringList;
Const
  ctFilePath = 'C:\Test\Out\OutPS\';
  ctFileName = 'complete.txt';
  ctFileContent = 'dummy file';
Begin
  psExitCode:= 1;
  // ... add your code here
  If psCounter > 0 Then
  Begin
    tmpFile := TStringList.Create;
    Try
      Try
        tmpFile.Add(ctFileContent);
        tmpFile.SaveToFile(ctFilePath + ctFileName);
        psLogWrite(1, '', 'Save complete file succes');
      Except
        psLogWrite(1, '', 'Save complete file error');
      End;
    Finally
      tmpFile.Free
    End;
  End;
End.

#filetransfer #mft #filemanagement

If you need any info  about this ‘generate a filet’ request, please let us know.

Best regards,

Limagito Team

By Limagito-Team Pascal Script , Share:
SEARCH