Scripts and Interfaces

Please note that we cannot provide support in developing your own scripts for your individual requirements.
We offer a fee-based individual development of scripts or extensions of BarcodeOCR if there is interest.

BarcodeOCR offers several interfaces to inform or automate downstream processes or to sort your documents individually.

TypeInterfaceGets calledLocation in Configrationtypischer Anwendungsfall
Type 1.bat script/.exe application after saving an output fileStep ADVANCEDFurther processing per output file
Type 2.bat script/.exe application after processing an input fileStep ADVANCEDFurther processing of multiple output files after an input file has been processed
Type 3PowerShell-Subfolderscriptduring processingStep RENAME/SORTINGSpecifying a subfolder path or overwriting the file name
Type 4PowerShell-Scriptafter saving an output fileStep ADVANCEDFurther processing per output file - with more options and more information
Type 5PowerShell-Scriptbefore a file is processedStep ADVANCEDPre processing of an input file, overwriting the configuration, aborting processing in special cases

When BarcodeOCR is installed, several sample scripts are stored in the "Script Samples" folder in the installation folder. These already prepare the passed parameters and are a good starting point for your individual logic.


Note on the execution of PowerShell scripts

For productive use of the finished script, it should be signed with a trusted code signing certificate and the ExecutionPolicy level should be reset. 

PowerShell scripts have a special feature compared to .bat scripts: Depending on the configuration and operating system, the execution of the scripts is not allowed by default. In this case, BarcodeOCR cannot execute the script and will also log a message in the error log. Before using a PowerShell interface, please make sure that you allow the execution of scripts on your system. (Help page from Microsoft)

The installed sample scripts are not digitally signed. In order to try them out in a test environment, an ExecutionLevel of "Unrestricted" is necessary. BarcodeOCR executes the scripts - depending on the system and installation - in the x86 or x64 PowerShell console. Please make sure that both environments are configured accordingly. 

With this setting you allow the execution of all PowerShell scripts. If you are unsure, please contact your IT support or IT administrator before configuring this setting.

The steps to adjust the setting

  1. Start the Windows PowerShell console (x86 and x64) as Administrator
  2. Execute the command Get-ExecutionPolicy and note down the current value (in the screenshot "Restricted") - This way you can reset the value later on
  3. Execute the command Set-ExecutionPolicy Unrestricted and confirm the entry at the query with y

Type 1 - bat/exe after saving an output file

General

  • The interface is called after each saving of an output file (error & success folder).

  • The parameters are passed in a fixed order - it is not possible to adjust the order of the parameters or the name of the parameters.

  • .bat scripts or .exe applications can be started

  • BarcodeOCR waits until the script is finished. Then the next file is prepared for saving

  • There is no timeout while waiting for the process to finish

Parameter

ParameterDescriptionSample value
-resultResult of the processingsuccess / error
-configurationNameName of the Configuration"Test"
-sourceFull path to the input file"C:\Config\dec24748\Test\Testfile.pdf"
-destinationFull path to the output file"C:\Config\dec24748\Test\Success\INV_12345.pdf"
-pageFromPage number of the first page in the source file1
-pageToPage number of the last page in the source file1
-errorReasonReason why the document became an error fileNone / NoBarcode / Duplicate / Error
-detectedBarcodeRecognized BarcodeINV_12345

Example of a the parameter call

Note: This form of transfer cannot be changed

-result=success -configurationName="Test" -source="C:\Config\dec24748\Test\Testfile.pdf" -destination="C:\Config\dec24748\Test\Success\\INV_12345.pdf" -pageFrom=1 -pageTo=1 -errorReason=None -detectedBarcode=INV12345


Type 2 - bat/exe after processing an input file

General

  • The interface is called before the input file is deleted - i.e. output files were created beforehand.
  • The parameters are passed in a fixed order - it is not possible to change the order of the parameters or the name.
  • .bat scripts or .exe applications can be started.
  • BarcodeOCR waits until the script is finished. Then the next file is prepared for saving
  • There is no timeout while waiting for the process to finish

Parameter

ParameterDescriptionSample value
-sourceFull path to the input file"C:\Config\dec24748\Test\Testfile.pdf"
-filesList of saved file names, recognised barcode and status "INV_1.pdf","INV_1","True"

Example of a the parameter call

Note: This form of transfer cannot be changed

-source="C:\Config\dec24748\Tour\test invoices.pdf" -files=""S-INV-PT-03757.pdf","INV-PT-03757","True";"S-INV-PT-03757_0.pdf","INV-PT-03757","True";"S-INV-PT-03757_1.pdf","INV-PT-03757","True";"S-INV-PT-03757_2.pdf","INV-PT-03757","True";"S-INV-PT-03757_3.pdf","INV-PT-03757","True";"S-INV-PT-03757_4.pdf","INV-PT-03757","True";"S-INV-PT-03757_5.pdf","INV-PT-03757","True";"S-INV-PT-03757_6.pdf","INV-PT-03757","True";"S-INV-PT-03757_7.pdf","INV-PT-03757","True";"S-INV-PT-03757_8.pdf","INV-PT-03757","True""  


Type 3 - PowerShell during processing

General

  • The interface is executed during the preparation of the saving of an output file.
  • The interface can optionally return two variables that will be used for storage
  • The parameters are passed as data objects
  • BarcodeOCR waits until the script has finished and interprets the returned values.
  • Renaming and duplicate handling defined in the user interface are applied anyway.
  • There is no timeout when waiting for the script.

Parameter

With this interface, a data object is given, which can also contain arrays and comprehensive texts:

General Parameter

ParameterDescriptionSample value
ConfigurationNameName of the configuration"Test"
ConfigurationGuidUnique Identifier of the configurationcbfc4771-7f73-481e-b1ca-e4b95eb3d605
ConfigurationFilePathFile path to the config file"C:\ProgramData\Keil IT\BarcodeOCR\AnalyserConfig.xml"
UsedBarcodeRecognized barcode used for separation and renamingBarcode-Content, if error file: empty
ResultWas the file placed in the success folder?True = File saved in success folder
False = File saved in error folder
ErrorReasonReason why the file was placed in error folderNoBarcode, CorruptedFile, Unknown, Duplicate, NameError
FileProcessStartTimeStart time of the input file
SourceFilePathFull path to the source fileC:\Config\dec24748\Tour\Sample.pdf
BackupFilePathFull path to the backup file (if that option is active)C:\Config\dec24748\Tour\Backup\Sample_eb3d605.pdf
DestinationFilePathFull path of the destination fileC:\Config\dec24748\Tour\Error\No_Barcode_1.pdf'
SubfolderSubfolder pathSubfolder\Sub-Subfolder
NumberOfPagesNumber of pages in the output document4
NumberOfRemovedPagesNumber ob pages that were removed due to 'remove blank pages' option0
StartPagePage number of the first page in the source file1
EndPagePage number of the last page in the source file4


Parameter per Page

The following information is passed as an array and is passed per page in the output document

ParameterDescriptionSample value

Number

Page Number4

RecognizedText 

Recgonized Text (If text recognition is enabled)"Lorum ipsum ...."
BarcodesList of recognized Barcodes in the pagePer Barcode: Type, Text, and X/Y-Coordinates

Return values

  • This interface can return two values to BarcodeOCR, which are taken into account in further processing.
  • The example script simplifies this step and offers two corresponding variables that only need to be set.
  • If empty variables are returned, the values are not overwritten
  • BarcodeOCR logs the returned values of the script in the run log.
  • If the script throws an error, the output of the script is ignored and the file is processed according to the settings of the configuration.
ParameterDescriptionSample value

SUBFOLDER_NAME

Path of the subfolder structure to be used (folders are created by BarcodeOCR if they do not exist).

Invoices
Invoices/CustomerName/BranchB

FILE_NAME

File name to be used as the output file. This can be overwritten by the ScriptInvoice_VariableFromSQL_Test.pdf


Type 4 - PowerShell after processing

General

  • The interface is called after each saving of an output file (error & success folder).
  • The parameters are passed as data objects
  • BarcodeOCR waits until the script has finished and interprets the returned values.
  • Renaming and duplicate handling defined in the user interface are applied anyway.
  • There is no timeout when waiting for the script.

Parameter

With this interface, a data object is given, which can also contain arrays and comprehensive texts:

General Parameter

ParameterDescriptionSample value
ConfigurationNameName of the configuration"Test"
ConfigurationGuidUnique Identifier of the configurationcbfc4771-7f73-481e-b1ca-e4b95eb3d605
ConfigurationFilePathFile path to the config file"C:\ProgramData\Keil IT\BarcodeOCR\AnalyserConfig.xml"
UsedBarcodeRecognized barcode used for separation and renamingBarcode-Content, if error file: empty
ResultWas the file placed in the success folder?True = File saved in success folder
False = File saved in error folder
ErrorReasonReason why the file was placed in error folderNoBarcode, CorruptedFile, Unknown, Duplicate, NameError
FileProcessStartTimeStart time of the input file
SourceFilePathFull path to the source fileC:\Config\dec24748\Tour\Sample.pdf
BackupFilePathFull path to the backup file (if that option is active)C:\Config\dec24748\Tour\Backup\Sample_eb3d605.pdf
DestinationFilePathFull path of the destination fileC:\Config\dec24748\Tour\Error\No_Barcode_1.pdf'
SubfolderSubfolder pathSubfolder\Sub-Subfolder
NumberOfPagesNumber of pages in the output document4
NumberOfRemovedPagesNumber ob pages that were removed due to 'remove blank pages' option0
StartPagePage number of the first page in the source file1
EndPagePage number of the last page in the source file4


Parameter per Page

The following information is passed as an array and is passed per page in the output document

ParameterDescriptionSample value

Number

Page Number4

RecognizedText 

Recgonized Text (If text recognition is enabled)"Lorum ipsum ...."
BarcodesList of recognized Barcodes in the pagePer Barcode: Type, Text, and X/Y-Coordinates


Type 5 - PowerShell before the input file gets processed

General

  • The interface is called after the file was recognized as new file in the inpout folder but before a file is processed by BarcodeOCR
  • The parameters are passed as data objects
  • BarcodeOCR waits until the script has finished and interprets the returned values.
  • There is no timeout when waiting for the script.

Parameter

With this interface, a data object is given, which can also contain arrays and comprehensive texts:

Allgemeine Parameter

ParameterDescriptionSample value
ConfigurationNameName of the configuration"Test"
ConfigurationGuidUnique Identifier of the configurationcbfc4771-7f73-481e-b1ca-e4b95eb3d605
ConfigurationFilePathFile path to the config file"C:\ProgramData\Keil IT\BarcodeOCR\AnalyserConfig.xml"
SourceFilePathFull path to the source fileC:\Config\dec24748\Tour\Sample.pdf


Return values

  • This interface can return two values to BarcodeOCR, which are taken into account in further processing.
  • The example script simplifies this step and offers two corresponding variables that only need to be set.
  • If empty variables are returned, the values are not overwritten
  • BarcodeOCR logs the returned values of the script in the run log.
  • If the script throws an error, the output of the script is ignored and the file is processed according to the settings of the configuration.
ParameterDescriptionSample value

 OVERWRITE_CONFIG 

Optional:
Expects a name of a configuration (as defined in the first step of the wizard, but case insensitive). If set and valid, the file is processed with the settings of the definied configuration

Test
<emptry string>

 DO_NOT_PROCESS 

If set to "true", the processing of the file by BarcodeOCR is aborted and the file remains in the input folder.true
false