Pascal Script

  • 22 May

    Manage the rule status change with the help of Pascal Script

    Q: We would like to manage the rule status change : turn HOLD, turn Release, etc. I didn’t find any “ps” command related to this need. Could you help us to stop/hold/enable status rules? Just missing this PS command to change rule status 😉

    Hope it exists…. based on type “psRuleChangeStatus( RuleID : Integer, newStatus : String/Integer… )” or something like that…
    A: In our latest version v2022.5.22.0 we added two new functions that will help you.
    ===============================================
    – Use psRuleSetHoldStatus to set the status of moving rule to HOLD. The RuleId can be found in the statusbar information.Function psRuleSetHoldStatus(_RuleId: Integer): Boolean;

    i.e. psRuleSetHoldStatus(1);
    ===============================================
    – Use psRuleSetReleaseStatus to set the status of moving rule to RELEASE. The RuleId can be found in the statusbar information.

    Function psRuleSetReleaseStatus(_RuleId: Integer): Boolean;

    i.e. psRuleSetReleaseStatus(1);
    ===============================================

    FYI: In this version we also added some new Pascal Script var that can be used for example in the ‘On Destination’ and ‘On Destinations’ Pascal Script options.
    • psFileDir
    • psFileSubDir
    • psFileSubDirFirst
    • psFileSubDirLast
    • psFilePath
    • psFileSubPath
    • psFileSubPathFirst
    • psFileSubPathLast
    Example:
    • WIN as Source, Root Path is C:\Scan\
    • During scan the following file was found: C:\Scan\Sub1\Sub2\Intro.pdf
    Result when using the new Pascal Script var will be:
    • psFileDir > C:\Scan\Sub1\Sub2
    • psFileSubDir > Sub1\Sub2
    • psFileSubDirFirst > Sub1
    • psFileSubDirLast > Sub2
    • psFilePath  > C:\Scan\Sub1\Sub2\
    • psFileSubPath > Sub1\Sub2\
    • psFileSubPathFirst > Sub1\
    • psFileSubPathLast > Sub2\

    #Filetransfer #PascalScript

    If you need any info about this ‘Manage the rule status change’ request, please let us know.

    Best regards,

    Limagito Team

  • 05 May

    Check pdf pagewidth in order to move files to a different folder

    Q: A big help would also be a width check. If pdf width > 300 mm move to another folder. Then I could use some system tools on the pdf.

    A: In version v2022.5.5.0 we added some Pascal Script function to achieve this.

    -First we added two WIN destinations.

    • Destination with ID1 should contain the pdf files with a width <= 300 points
    • Destination with ID2 should contain the pdf files with a width > 300 points

    Limagito File Mover multiple Windows destinations

    -Next you’ll some Pascal Script

    Limagito FileMover Pascal Script option

    -Please Add and Enable ‘On Destinations

    Var
      tmpCount: Integer;
      tmpHeight, tmpWidth: Double;
      tmpFile: String;
    Const
      ctMaxWidth = 300;  
    Begin
      psExitCode:= -1;
      // ... add your code here
      tmpFile := psFilePath + psFileName;
      If psPdfGetPageCount(tmpFile, '', tmpCount) Then
        psLogWrite(1, '', 'Page Count of ' + tmpFile +' : ' + IntToStr(tmpCount));
      If psPdfGetPageHeight(psFilePath+psFileName, '', 1, tmpHeight) Then
        psLogWrite(1, '', 'Page Height of ' + tmpFile + ' : ' + FloatToStr(tmpHeight));
      If psPdfGetPageWidth(psFilePath+psFileName, '', 1, tmpWidth) Then
      Begin
        psLogWrite(1, '', 'Page Width of ' + tmpFile + ' : ' + FloatToStr(tmpWidth));
        // Check Width
        // Pdf Files <= ctMaxWidth should go to DestinationID 1 
        // Pdf Files > ctMaxWidth should go to DestinationID 2    
        If (psDestinationID = 'ID1') And (tmpWidth <= ctMaxWidth) Then psExitCode := 1; 
        If (psDestinationID = 'ID2') And (tmpWidth > ctMaxWidth) Then psExitCode := 1;  
      End
      Else
      begin
        // Error Loading Pdf File, set psExitCode to 0
        psExitCode := 0;
      End;   
    End.

    Limagito File Mover Pascal Script

    – RunTime Log Result:

    Limagito File Mover RunTime Log result

    #Filetransfer #PDF

    If you need any info about this ‘Check pdf pagewidth’ option, please let us know.

    Best regards,

    Limagito Team

    By Limagito-Team Pascal Script PDF ,
  • 31 Mar

    Csv to Xls conversion problems

    Q: Csv to Xls conversion problems. I have a small problem with the conversion of .csv to .xls files. My original file is separated by ; saved as .txt.

    • I also tried with a comma separated .csv and I get the same result.
    • I also tried to import full csv as text
    • I also tried adding a header
    • I still get the same result

    I have attached some screenshots, I have also attached the txt file to convert. My file contains data in French with accents, can this have an impact?

    A: It looks like a problem with the encoding of the txt file. We converted it to UTF8 first using a Pascal Script and afterwards the conversion worked just fine.

    1. Open the Pascal Script option:

    Limagito File Mover Pascal Script option

    2. Enable and add the following ‘On Destination’ Pascal Script. This will first change the Encoding of the Source txt file to UTF8. The conversion to XLS was ok afterwards.

    Var
      tmpFile: String;
    Begin
      psExitCode:= 0;
      // ... add your code here
      tmpFile := psFilePath + psFileName;
      If psChangeTxtEncoding(tmpFile, tmpFile, 0) Then
        psExitCode := 1;
    End.

    Limagito File Mover conversion problems

    More information about the “psChangeTxtEncoding function”:

    Use psChangeTxtEncoding to convert the encoding

    > Encoding possibilities:
    0: UTF8
    1: UTF7
    2: Unicode
    3: Default
    4: BigEndianUnicode
    5: ASCII
    6: ANSI
    7: ASCII TRIM
    8: ANSI TRIM

    i.e. psChangeTxtEncoding(psFilePath + psFileName, psFilePath + psFileName, 0);

    This script will change the encoding of the original source file before it is converted to .xls using XLS as Destination.

    Some extra screenshots of the XLS as Destination setup:

    Limagito File Mover conversion problems

    Limagito File Mover conversion problems

    #Filetransfer #csv #xls

    If you need any info about this ‘conversion problems’ issue, please let us know.

    Best regards,

    Limagito Team

1 10 11 12 13 14 15 16 26
SEARCH