Q: I need to know if a status file can be generated when a file is successfully moved that includes the source location?
We would like a log file generated called 123456.pdf.log that contains the following data:
Remote path: C:\upload\input\123456.pdf
Affinity PDF has been transferred to distiller
Delivery log name: C:\upload\output\123456.pdf.log
The remote path is the location where the file was moved from
The second line is just a text line
The Delivery Log Name is the location where the file was placed and the name of the log file
A: Yes this is possible using some Pascal Script.
Let’s start with the Source. In our example it is a Windows Folder:
‘C:\Test\In_PDF\’.
Important, in the function Setup you need to set the ‘Destination Options’ to ‘Exit Cyclus on Error’. Reason is that we want to be 100% sure that the file was moved before we write the status file.
Destinations Setup, the first destination is the folder where the pdf needs to be moved to. The second destination is the ‘Pascal Script’ needed for the creation of the status file.
We added a Windows folder as first Destination. Default Setup is ok.
The second Destination is our ‘Pascal Script’ needed for the creation of the status file:
Var tmpList: TStringList; tmpLogName: String; tmpLogPath: String; Const ctLogRootDir = 'C:\Test\Out\PDF'; Begin tmpLogPath := ctLogRootDir + '%SFS\'; psExitCode:= 1; // ... add your code here tmpList := TStringList.Create; Try tmpLogName := '%SFN.log'; Try tmpList.Add('Remote path: %SFP%SFN'); tmpList.Add('Affinity PDF has been transferred to distiller'); tmpList.Add('Delivery log name: ' + tmpLogPath + tmpLogName); // Save psLogWrite(1, '', 'SaveToFile: ' + tmpLogPath + tmpLogName); tmpList.SaveToFile(tmpLogPath + tmpLogName); Except psLogWrite(1, '', 'Log Create Error'); End; Finally tmpList.Free; End; End.
RunTime Log Result:
Output Folder Result: