Pascal

  • 29 Dec

    Pascal Script Bugfixes

    Dear Users,

    In build v2019.12.29.0 we migrated to another Fork of Pascal Script. The one we were using was giving some issues on x64. The latest bug we received from a user was a Service crash when Pascal Script was trying to do a ‘LoadFromFile(File)’ when the ‘File’ was locked by another application.

    Regards,
    Limagito Team

  • 19 Nov

    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

  • 07 Jul

    Trigger an email alert when files build up in a folder

    Dear Users,

    We got the following request from a user: ‘Trigger an email alert when files build up in a folder’. Although this isn’t the goal of our file transfer tool we decided to give it a try.

    What we did to achieve this:

    1) Add the Windows Source folder you want to check

    2) Add the following ‘On Rule Begin’ Pascal Script. This script will reset the file counter when the rule is triggered.

    Begin
      psExitCode:= 1;
      // Reset File Counter
      psResetCounter;
    End.


    3) Enable ‘Copy Files’ and ‘Preference Order’ in the Function Setup.

    4) Add two destinations. Important, the first destination must be ‘Pascal Script’. The second destination is ‘SMTP’ (email).

    5) Destination Pascal Script. Please adjust the ctMaxFiles constant value that will be used to trigger the email. At the moment this is set to 10 files.

    Const
      ctMaxFiles = 10;
    Begin
      psExitCode:= 1;
      // ... add your code here
      If psCounter = ctMaxFiles then
      Begin
        psLogWrite(1, '', 'Max Files Reached, Counter Value: ' + IntToStr(psCounter));
        psExitCode := 0;
      End;
    End.

    6) Setup the Destination SMTP options. These will be used when sending the email.

    7) The result. Single email event when files build up in a folder.

    If you need any help, do not hesitate to ask. We are here to help.

    Regards,

    Limagito Team

1 2 3 4