File Mover Blog

  • 19 Mar

    Move a file and send email with filename and line count

    Q: Move a file and send email with filename and line count.

    Can you help me with the following question.

    I want to move a file and in an email state the file name (always a text file .csv, .txt) and a line count
    Test.txt – 12 lines

    Can this be done?

    A: Yes this is possible. We have created a Pascal Script for you to achieve this.

    1. It is important that you’ll only handle txt and csv files (text based files). We added a File Name Include File Filter, just to be sure:

    Limagito File Mover Filename Filter

    2. Open our ‘Pascal Script’ option:

    Limagito File Mover Pascal Script option

    Add and enable the following ‘On Destination’ Pascal Script. This script will load the txt/csv file and will put the line count information into our %VSA parameter which can be use within our notification email.

    Var
      tmpCount: Integer;
      tmpList: TStringList;
    Begin
      psExitCode:= 0;
      // ... add your code here
      tmpList := TStringList.Create;
      Try
        Try
          // Load Source File
          tmpList.LoadFromFile(psFilePath + psFileName);
          // Count Lines
          tmpCount := tmpList.Count;
          // Info to be used in email
          psVSA := psFileName + ' - ' + IntToStr(tmpCount) + ' lines';
          psLogWrite(1, '', 'Information: ' + psVSA);    
          // Set Result OK
          psExitCode := 1;
        Except
          psLogWrite(1, '', 'Error loading: ' + psFilePath + psFileName);
        End;
      Finally
        tmpList.Free;
      End;  
    End.
    

    Limagito File Mover Pascal Script option

    3. Now you can use the %VSA as parameter within the email setup:

    Limagito File Mover Email Notification Setup

    Limagito File Mover Email setup

    4. Email Result:

    Limagito File Mover Email result

     

    #Filetransfer

    If you need any info about this option, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Email Pascal Script
  • 06 Mar

    Log Report Summary parameter added in Limagito File Mover

    In version v2022.3.6. we added a Log Report Summary parameter: %LRS

    Some screenshots will help you to understand how you can use this parameter to send you a summary email after the Rule has finished.

    Please select ‘Rule Events’ menu item.

    Limagito File Mover Rule Events menu item

    We are going to use the ‘On Success’ Event to trigger an email so enable ‘On Success’ and ‘Enable Mail’.

    Limagito File Mover Rule Events Setup

    We added the new Summary parameter %LRS into the body of the email message.

    Limagito File Mover Rule Events setup

    Important, do not forget to enable ‘Trigger mail event after scan’ because the %LRS parameter is only available after scanning source files. You can find this option under the ‘Options’ tab of the ‘Rule Events’ setup.

    Limagito File Mover Rule Events Setup

    RunTime Log Result:

    Limagito File Mover RunTime Log

    Email we received:

    Limagito File Mover Report Summary email

    #Filetransfer

    If you need any info about this ‘Log Report Summary’ option, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Logging , ,
  • 10 Feb

    Send different on success or failure notifications based on file type

    Q: Is it possible in the same moving rule to have it send different on success or failure notifications based on file type. For example I only want it to send a notification if it is a pdf file extension. Other files in the job would still copy but only notify on the pdfs. I am working on a group wide project and it would help out a lot. The PDF file extension was just an example and would be other file formats.

    A: We added a new option ‘Use Pascal Script as event Precondition’ in Version v2022.2.9.0

    – Open Rule Events Setup

    Limagito File Mover Pascal Script Setup

    – Select the Event you want to setup (in our example this is the ‘On Success’ event) > Options Tab > Enable ‘Use Pascal Script as event Precondition’

    Limagito File Mover Pascal Script Use Pascal Script As Precondition

    – Switch to ‘Pascal Script’ Tab and Enable Pascal Script.
    – Add the following script to include only .pdf files for the ‘On Success’ event. This is just a simple example but can be extended to meet all your needs.

    Begin
      // ... add your code here
      If SameText(ExtractFileExt(psFileName), '.pdf') Then
        psExitCode := 1
      Else
        psExitCode := 0;
    End.

    Limagito File Mover Rule Events Pascal Script

    #Filetransfer

    If you need any info about this ‘notifications based on file type’ option, please let us know.

    Best regards,

    Limagito Team

1 49 50 51 52 53 54 55 136
SEARCH