Pascal Script

  • 30 Mar

    How to use 7z compression in Pascal Script

    How to use 7z compression in Pascal Script

    In version v2024.3.20.0 we added two new Pascal Script functions which allows you to use 7z compression.

    • Function ps7zCompress(Source: String; Destination: String; Password: String; Options: TStringList): Boolean;
    • Function ps7zCompressEx(Source: String; SourceFiles: TStringList; Destination: String; Password: String; Options: TStringList): Boolean;

    We added an example where we’ll be looking for a certain file called ‘trigger.txt’ within subfolders. If this trigger file is found we’ll compress the complete subfolder. The goal is to create a compressed backup of the complete subfolder content.

    • As Source we used a Windows Folder:

    limagito file mover windows folder as source

    • The content of subfolder ‘Sub’ looks like the following screenshot. It contains the ‘trigger.txt’ file which we’ll use to start the compressing mechanism.

    limagito file mover windows folder as source

    • We added the following include filename filter, because we are searching for the ‘trigger.txt’ only. This file will determine which subfolder we need to compress.

    limagito filemover filename include filter

    • Enable ‘Include Subdirectories’ within the Dir Filter’ setup:

    limagito filemover directory filter

    • We enable our ‘File Memory’ option because we only want to compress its subfolder once. If the trigger.txt is changed, then we’ll compress the subfolder again.

    limagito file mover file memory option

    – Function is set to ‘Copy’ because we want to keep the source files.

    limagito file mover function setup

    • Now add our ‘Pascal Script’ as Destination:
      • Please add the following script: link
      • Please adjust the following Const if needed:
        • ctZipPassword
        • ctZipExt
        • ctOutputPath

    7z compression in Pascal Script

    • The new ps7zCompress function has quite some options available which you can adjust if needed:
      • AddDirectory = False, True (default: True)
      • CompressionMethod = Copy, Deflate, Deflate64, BZip2, LZMA, LZMA2, PPMd (default: Deflate)
      • DuplicateCheck = None, Existing, All (default: Existing)
      • DuplicateAction = Overwrite, Error, Skip (default: Overwrite)
      • EncryptionMethod = None, AES128, AES192, AES256, ZipCrypto (default: ZipCrypto)
      • FileIncludeFilter = (default: *.*)
      • ScanSubDirectories = False, True (default: True)
      • Level = 0..9 (default: 7)
      • Threads = 1 .. 255 (default: 1)
      • Error = ‘Error Description if compression fails’

    7z compression in Pascal Script

    • RunTime Log Result:

    limagito filemover runtime log

    • Output Result:

    7z compression in Pascal Script

    If you need any help with our new ‘7z compression in Pascal Script’ feature, please let us know.

    Best Regards,

    Limagito Team

    #7z #pascalscript #managedfiletransfer #FileManagement #filetransfer

    By Limagito-Team Pascal Script ZIP ,
  • 17 Mar

    How to check the printer status before sending a pdf to the printer update

    How to check the printer status before sending a pdf to the printer

    Previous article: link

    We added a new Pascal Script function in version v2024.3.17.0

    Function psGetUrlContent(Const aUrl, aParams: String; var aError: String): String;

    Please check the previous article, we only changed the following part:

    • First Destination: Pascal Script
      • Please add the following script: link
      • We added the following Const values which you’ll need to adjust:
        • ctCheckPrinterConnection: This will add the possibility to check the printer using the URL of the printer (web page). A lot of network printers have an internal web server that we’ll be using to check if the printer is online.
          • Set this value to ‘TRUE’ if you want to use this option, otherwise set this Const to ‘FALSE’.
        • cpPrinterUrl: If ‘ctCheckPrinterConnection := True;’ then add the Url (web interface) of the Printer we need to check.
        • ..

    We added this update because the customer had a printer where, by default, only its web interface was enabled. In the previous article we used a telnet connection which seems to be disabled with some printer due to security reasons.

    check the printer status update

    If you need any help with this ‘check the printer status’ request, please let us know.

    Best Regards,

    Limagito Team

    #pdf #managedfiletransfer #filetransfer #filemanagement

  • 17 Mar

    How to move files to different ftp folders under the same root

    How to move files to different ftp folders under the same root on the same server

    Q: Conditional destination request. We are looking for an easy way (one channel) to move files to different ftp folders (more than 100 folders) under the same root on the same server, where filename prefix (3 char) is the key to which folder. Prefix and folder name are different.

    A few examples:
    • BBL > folder1
    • ABB > folder2
    • BYR > folder4
    • BYP > folder5
    • DAT > folder6
    I have been looking at your blog post without finding anything like it. The list of prefixes and folders could be a text table in the script or in a csv file. Do you have a script for this?
    A: Yes this is possible, please have a look at the following screenshots. This setup can be used with other Sources and Destinations too.
    – We used a Windows folder as Source:
    limagito file mover windows folder as source
    – Open our Pascal Script option
    limagito file mover pascal script option

    Please enable and add the following ‘On Destination’ Pascal Script:

    • Please add the following script: link
      • The script strips the first 3 characters from the filename by using ‘copy(psFilename, 1, 3)’
      • The stripped part is compared with ‘BBL’, ‘ABB’ .. ‘DAT’
      • Depending on the result of the compare, a folder name is added to our variable psVSA ( pascal script Var String A )
      • This psVSA variable will be used in the Destination setup as parameter (%VSA, which contains data from psVSA)
    • You’ll need to adjust the folder names and add more prefixes if needed
    files to different ftp folders
    – In the FTP as Destination Setup, please adjust the ‘Create Subdir’ option to:   %VSA\%SFS
    • Here we used the %VSA parameter, set in the Pascal Script, which contains the desired subdirectory name
    limagito file mover destination setup
    – Feedback customer:

    That looks easy. Thank you very much.

    If you need any help with this new option, please let us know.

    Best Regards,

    Limagito Team

    #ftp #sftp #managedfiletransfer #filetransfer #filemanagement

1 2 3 4 26
SEARCH