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.
Type | Interface | Gets called | Location in Configration | typischer Anwendungsfall |
---|---|---|---|---|
Type 1 | .bat script/.exe application | after saving an output file | Step ADVANCED | Further processing per output file |
Type 2 | .bat script/.exe application | after processing an input file | Step ADVANCED | Further processing of multiple output files after an input file has been processed |
Type 3 | PowerShell-Subfolderscript | during processing | Step RENAME/SORTING | Specifying a subfolder path or overwriting the file name |
Type 4 | PowerShell-Script | after saving an output file | Step ADVANCED | Further processing per output file - with more options and more information |
Type 5 | PowerShell-Script | before a file is processed | Step ADVANCED | Pre 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
- Start the Windows PowerShell console (x86 and x64) as Administrator
- Execute the command Get-ExecutionPolicy and note down the current value (in the screenshot "Restricted") - This way you can reset the value later on
- 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
Parameter | Description | Sample value |
---|---|---|
-result | Result of the processing | success / error |
-configurationName | Name of the Configuration | "Test" |
-source | Full path to the input file | "C:\Config\dec24748\Test\Testfile.pdf" |
-destination | Full path to the output file | "C:\Config\dec24748\Test\Success\INV_12345.pdf" |
-pageFrom | Page number of the first page in the source file | 1 |
-pageTo | Page number of the last page in the source file | 1 |
-errorReason | Reason why the document became an error file | None / NoBarcode / Duplicate / Error |
-detectedBarcode | Recognized Barcode | INV_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
Parameter | Description | Sample value |
---|---|---|
-source | Full path to the input file | "C:\Config\dec24748\Test\Testfile.pdf" |
-files | List 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
Parameter | Description | Sample value |
---|---|---|
ConfigurationName | Name of the configuration | "Test" |
ConfigurationGuid | Unique Identifier of the configuration | cbfc4771-7f73-481e-b1ca-e4b95eb3d605 |
ConfigurationFilePath | File path to the config file | "C:\ProgramData\Keil IT\BarcodeOCR\AnalyserConfig.xml" |
UsedBarcode | Recognized barcode used for separation and renaming | Barcode-Content, if error file: empty |
Result | Was the file placed in the success folder? | True = File saved in success folder False = File saved in error folder |
ErrorReason | Reason why the file was placed in error folder | NoBarcode, CorruptedFile, Unknown, Duplicate, NameError |
FileProcessStartTime | Start time of the input file | |
SourceFilePath | Full path to the source file | C:\Config\dec24748\Tour\Sample.pdf |
BackupFilePath | Full path to the backup file (if that option is active) | C:\Config\dec24748\Tour\Backup\Sample_eb3d605.pdf |
DestinationFilePath | Full path of the destination file | C:\Config\dec24748\Tour\Error\No_Barcode_1.pdf' |
Subfolder | Subfolder path | Subfolder\Sub-Subfolder |
NumberOfPages | Number of pages in the output document | 4 |
NumberOfRemovedPages | Number ob pages that were removed due to 'remove blank pages' option | 0 |
StartPage | Page number of the first page in the source file | 1 |
EndPage | Page number of the last page in the source file | 4 |
Parameter per Page
The following information is passed as an array and is passed per page in the output document
Parameter | Description | Sample value |
---|---|---|
Number | Page Number | 4 |
RecognizedText | Recgonized Text (If text recognition is enabled) | "Lorum ipsum ...." |
Barcodes | List of recognized Barcodes in the page | Per 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.
Parameter | Description | Sample value |
---|---|---|
SUBFOLDER_NAME | Path of the subfolder structure to be used (folders are created by BarcodeOCR if they do not exist). | Invoices |
FILE_NAME | File name to be used as the output file. This can be overwritten by the Script | Invoice_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
Parameter | Description | Sample value |
---|---|---|
ConfigurationName | Name of the configuration | "Test" |
ConfigurationGuid | Unique Identifier of the configuration | cbfc4771-7f73-481e-b1ca-e4b95eb3d605 |
ConfigurationFilePath | File path to the config file | "C:\ProgramData\Keil IT\BarcodeOCR\AnalyserConfig.xml" |
UsedBarcode | Recognized barcode used for separation and renaming | Barcode-Content, if error file: empty |
Result | Was the file placed in the success folder? | True = File saved in success folder False = File saved in error folder |
ErrorReason | Reason why the file was placed in error folder | NoBarcode, CorruptedFile, Unknown, Duplicate, NameError |
FileProcessStartTime | Start time of the input file | |
SourceFilePath | Full path to the source file | C:\Config\dec24748\Tour\Sample.pdf |
BackupFilePath | Full path to the backup file (if that option is active) | C:\Config\dec24748\Tour\Backup\Sample_eb3d605.pdf |
DestinationFilePath | Full path of the destination file | C:\Config\dec24748\Tour\Error\No_Barcode_1.pdf' |
Subfolder | Subfolder path | Subfolder\Sub-Subfolder |
NumberOfPages | Number of pages in the output document | 4 |
NumberOfRemovedPages | Number ob pages that were removed due to 'remove blank pages' option | 0 |
StartPage | Page number of the first page in the source file | 1 |
EndPage | Page number of the last page in the source file | 4 |
Parameter per Page
The following information is passed as an array and is passed per page in the output document
Parameter | Description | Sample value |
---|---|---|
Number | Page Number | 4 |
RecognizedText | Recgonized Text (If text recognition is enabled) | "Lorum ipsum ...." |
Barcodes | List of recognized Barcodes in the page | Per 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
Parameter | Description | Sample value |
---|---|---|
ConfigurationName | Name of the configuration | "Test" |
ConfigurationGuid | Unique Identifier of the configuration | cbfc4771-7f73-481e-b1ca-e4b95eb3d605 |
ConfigurationFilePath | File path to the config file | "C:\ProgramData\Keil IT\BarcodeOCR\AnalyserConfig.xml" |
SourceFilePath | Full path to the source file | C:\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.
Parameter | Description | Sample 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 |
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 |