Skip to main content

Connect Scripting

The second method for file conversion and manipulation is via scripting. But before we continue…

Scripting assumes a certain skill and knowledge level from a JobFlow user. Users need to be familiar with the basics of scripting and understand concepts such as arguments. We do not assume any responsibility for anything bad that might happen as a result of a poorly written script.

We have tried to make it as easy as possible for Fiery JobFlow users to implement scripts. In order to support user defined scripts, Fiery JobFlow will provide all the necessary information required to process a job via a script as effective as possible. This information is provided by JobFlow feeding the script with so-called arguments.

Fiery JobFlow provides the following arguments:

  1. Input Location: a temporary location where JobFlow will make the file available for processing.
  2. Output Location: a temporary location where JobFlow will wait for the processed file to be copied.
  3. Job Name: the job name as shown in JobFlow.
  4. Workflow: the name of the workflow where the script was initiated.
  5. Preflight Report: location of the last preflight report generated in that workflow.
  6. Workflow Vault: temporary location created by Fiery JobFlow that exists as long as a job exists in a workflow. If a workflow contains multiple scripts this location can be used to share data between scripts.
  7. Next module ID: the ID for the next module that follows the Connect module. This ID is needed for working with JobFlow Master Variables.

Arguments don't have names and the script needs instructions to know the order to interpret the arguments.

Important note: arguments provided by the user always come first!

Most of the scripts shown in this document have a similar structure:

  1. Set the main variables used in the script. These variables are set by the parameters that are provided to the script via JobFlow.

  2. Check if utilities run via a script are installed. If they are not installed the script stops and logs the error in a log file that will be written in the folder where the script is running.

  3. The main procedure that needs to be executed for this script.

An example of simple script.

simple.bat
:: Disclaimer: scripts are provided as-is and most of them use tools that are open source
:: or require a (small) license fee when used in a commercial environment. It is the
:: responsibility of the end user that use scripts to respect the license agreement for
:: these tools. EFI can not be held responsible in any way if scripts don't behave like
:: they should do resulting in any form of financial loss or downtime. Have a good day.

:: [Description, link to 3rd party app]
:: [Author], [Date]

:: JobFlow arguments, information that JobFlow makes available to the script
set INPUT=%~1
set OUTPUT=%~2
set JOBNAME=%~3
set WORKFLOW=%~4
set PREFLIGHT=%~5
set VAULT=%~6
set NEXTMODULEID=%~7

:: Static variables, information that we use to make the script easier to manege
:: Location of this script
set pathScript=%~dp0
:: Name of this script
set ScriptName=%~n0
:: File path where we want to save the log file. We like to use JobFlow Vault.
set pathLog=%VAULT%\%ScriptName%.log
:: File path where we will look for any additional applications we want to use
set pathInclude=%pathScript%\_include

:: Helper Apps
:: #scriptname#
:: Where in the _include path can we find the application we need?
set pathApp=%pathInclude%\app.exe
:: Make sure the application exists
if not exist %pathApp% (
>>%pathLog% echo %DATE% %TIME% [ERROR] Cannot find application at %pathApp%. This is serious. Exit script.
exit /b 1
)

:: This is where we process the JobFlow job with the 3rd party app.
:: Note: this command is an _example_ and is different for every app

:do_something
%pathApp% %INPUT% %OUTPUT%\%JOBNAME%.pdf
:: Check if something worked
if %ERRORLEVEL% NEQ 0 (
>>%pathLog% echo %DATE% %TIME% [ERROR] An error occured while doing something. Exit script.
exit /b 1
)
>>%pathLog% echo %DATE% %TIME% [INFO] We processed %INPUT% with %pathApp% to %OUTPUT%\%JOBNAME%.pdf

:: We're done. Back to JobFlow.
:success
exit /b 0

In JobFlow, the script would be called as follows in the Connect module script settings: c:\scripts\simple.bat The 3rd party application has to exist at c:\scripts\_include\app.exe