ELP provides a low level method to define and set variables, read variables from different sources and place them into the document. This works for any kind of data streams, so for example also for Postscript!
-
ELP provides quite some methods of gathering variables
Identifiers of a variable must follow some rules:
-
Must be enclosed by hashes: #<name-of-variable>#
-
Some characters are not allowed like colon ':', '<', '>' and ' ' (blank)
-
User defined ones (e.g. #MyVariableName#) should be initialized (e.g. “Not yet used”) in the in the rule GLOBAL like: variable=#MyVariableName#:Not yet used
Short summary what is described in details in this document:
-
Some variable names are predefined, they are listed in the next table.
-
Variables can be defined using the key Variable=#name#:value.
-
The variable name is treated case sensitive in alle Search, Trigger and Replacement-functions.
- Reading variables from Active Direcoriy, File, Registry, Environment etc. their names are searched in the existing variable list case insensitive. The new read content is replaced, but the name remains in the predefined sensitivity.
-
Variables be loaded out of ASCII files using the key Variable_File. In that file is each line a definition like this: VariableName=Value
-
Provide access to Active Directory and to the system environment variables
-
ELP can also handle counter, which are normal variables, but they can be increased or decreased by any amount, once executed in a rule, maybe triggered by a searched Argument. Special counter are JobCounter.
-
ELP searches for the names of the variables in the data stream, as well as in all loaded forms/macros. Once found they are automatically replaced with the current value. So for example page counter can be inserted.
-
With search and StoreNextWordToVariable can ELP extract / read nearly any information out of the data stream into variables.
-
With Search_RowNo is ELP able to read any information out of the data stream into a variable.
-
Variable scan finally be stored into a file (Accounting and Reporting) or can be saved to hand them over to the next print job. (Counters)
-
How Variables can be used
Please note, that the limitation for finding the tags in the data streams is the same, as explained in the Search and Trigger key sections. If ELP is not able to find the key, then please send your local distributor (W-ELP Control Center, License TAB, About box) the print data, we will try to find the reason.
Hints:
-
To keep ELP fast processing the print jobs, wrap the search variables into the suggested start and stop characters: #! Like#Variable#.
-
If leading blanks are used for right alignment, use double quotes for the value part: Variable=#MyVariable#:" 90,50Euro".
-
You may format the variable values using any predefined font attributes, but also the formatting can be done in the value part, like this: Variable=#MyVariable#:\x0E\x1B)s1p12vs3b4099T 90,50 ?\x0F
How Variables can be used:
-
Generate a counter loop
1. ELP provides quite some methods of gathering variables
Variables can be used to collect information from various sources. See chapter 1. Later Variables can be used to automatically print then in forms or data streams, simply by putting the variable name in. if, for example, you did develop a form with the forms & filed installer and there the variable #DATENUM_US# is used, then the variable is replaced with "01/10/2010".
1.1. The predefined Variables which are available at start-up of the process:
A shortened list of the most popular variables.
Variables available on startup of each job, before any data stream bytes are read:
Value-Name | Description |
#ACTREADPAGECOUNTER# | While reading the data stream into ELP, this key will hold the actual read page number. Please note, that you need to turn PreParsing=ON in the rule GLOBAL. |
#ACCTOTALPAGES# | total pages for accounting |
#DRIVERLOCATION# | Location field content of the printing windows queue |
#DRIVERCOMMENT# | Comment field content of the printing windows queue |
#ELP_FORMS_PATH# | Contains the forms path from the ELP command line argument. Backslash or slash (Unix) is added! It can be changed using the WKDIR command. |
#ELPCOPYFACTOR_K# | The amount of copies from the last defined K command in an ELP_Command. For evaluations or usage of that variable in rules, the ELP_Command located in the data stream itself, e.g. <<K2;>> is NOT available at that time. |
#ELP_PROG_PATH# | Path to the ELP Software, In windows to the convert.exe file, usually C:\Program Files (x86)\welp\ with [back]slash at the end. |
#ELP_STARTUPFORMS_PATH# | On start same content as #ELP_FORMS_PATH# above, but fixed for ever to the initialization value. |
#HOSTNAME# | The variable is set to the content of start-up -Q7 operand. It contains the name of the Host without leading \\ like the #PCNAME# does have. |
#IN_ELP_FILENAME# | Contains the incoming file name, including the full path from W-ELP command line argument. Variable is mostly used by call commands. IMPORTANT NOTE: In the versions of ELP (March 2011), this file could be the original print file located in the spooler. So do NOT use it for building additional file names. |
#IN_ELP_FILENAMEWITHOUTPATH# | Contains the incoming file name, without path from W-ELP command line argument. Variable is mostly used by call commands. IMPORTANT NOTE: In the versions of ELP (March 2011), this file could be the original print file located in the spooler. So do NOT use it for building additional file names. |
#JOBID# | Contains the ID which is handed over from the spooler. For Windows either the W-ELP Print Processor or W-ELP Port Monitor passes on this value. |
#OUT_ELP_FILENAME# | Contains the outgoing file name, including the full path from W-ELP command line argument. Variable is mostly used by call commands. |
#OUT_ELP_FILENAMEWITHOUTPATH# | Contains the outgoing file name, without path from W-ELP command line argument. Variable is mostly used by call commands. |
#PCNAME# | The variable is set to the content of start-up -P2 operand, or read with a higher priority from the PJL ATTRIB Commands out of the data stream. In most cases the content is \\Hostname. Sometimes it is populated as \\<IP-v4-Address> or \\<IP-v6-Address>. |
#PRINTDOCNAME# | The variable is set to the content of start-up -P4 operand |
#PRINTDOCNAME_UNI# | Deprecated since year 2021: The variable is set to the content of start-up -P4 operand (in Unicode) |
#PRINTERDRIVERNAME# | The variable is set to the content of start-up -Q1 operand |
#PRINTERNAME# | The variable is set to the content of start-up -P1 operand |
#PRINTERSHARENAME# | The printer share name is mainly for MS windows integration in order to resend the same job to the same queue using the expression: OutPort=\\#HOSTNAME#\#PRINTERSHARENAME# |
#RANDOM# | random number from file name |
#USERNAME# | The variable is set to the content of start-up -P3 operand, the user name of the Job Info from spooler, or read with a higher priority from the PJL ATTRIB Commands out of the data stream. |
#USERNAME_UNI# | Same as above, but in Unicode notation for accounting the full document names in your local language. |
#USERNAMECOMMANDLINE# | The variable is set to the content of start-up -P3 operand, the user name of the Job Info retrieved from the spooler. |
#USERNAMECOMMANDLINE_UNI# | Same as above, but in Unicode notation for accounting the full document names in your local language. |
#PAGESCOMMANDLINE# | Windows: Page counter from the spooler. Non-Windows: Counter provided with the –p5 command line argument. Please note, the value is never changed at all. It is not modified using for example any ELP copy command. This variable can be used for example to account the amount of pages in data streams not using PCL5. |
Available date and time variables (Available at start up)
Value-Name | Description | Sample |
#ACTTIME# | Hours:Minutes:Seconds | 15:45:55 |
#DATEDDMMYYYY# | DDMMYYYY | 01062004 |
#DATEMMDDYYYY# | MMDDYYYY | 06012004 |
#DATENUM# | Day.Month.Year | 01.6.2004 |
#DATENUM_US# | Month/Day/Year | 06/01/2004 |
#DATESERIAL# | Serial number for date and time | 20110423152822 |
#DATESERIALLONG# | Serial number for date and time | with millisecond 201104231528220157 |
#DATETEXT# | Day Month Year text | 6 June 2004 |
#DATETEXT_D# | dito in German | 06 August 2005 |
#DATETEXT_IT# | dito in Italian | 10 Settembre 2018 |
#DATETEXT_PL# | dito in Polish | |
#DATETEXT_SP# | dito in Spanish | 10 Septiembre 2018 |
#MILLISECONDS# | Milliseconds of the start time | 000 to 999 |
#MONTH# | January, February, March etc | September |
#MONTH_D# | dito in German | Juni |
#MONTH_IT# | dito in Italian | |
#MONTH_PL# | dito in Polish | |
#MONTH_SP# | dito in Spanish | |
#MONTHNUM# | Month numerical 01-12 | 09 |
#TODAYNUM# | The actual day of today | 01, 02 .. 31 |
#WEEKDAY# | Sunday, Monday, Tuesday etc. | Sunday |
#WEEKDAY_D# | dito in German | Montag |
#WEEKDAY_IT# | dito in Italian | |
#WEEKDAY_PL# | dito in Polish | |
#WEEKDAY_SP# | dito in Spanish | Lunes |
#YEARNUM# | Year | 2018 |
Variables which are generated on demand during the treatment of the data stream
Value-Name | Description |
#ACCTOTALPAGES# | total pages for accounting |
#COPYCOUNT# | Only usable in conjunction with ELP_Command K for copy generation. Used in a macro with a macro number of larger then 25000, an automatic copy counter can be defined, like Copy 1, Copy 2 etc.. |
#EMAILERRORCODE# | The variable is initialized with 0. If an error occurs when sending email via PowerShell, the variable is set to the error code 1 and the section [On_Error_Email] will be executed. |
#EMAILSUBJECT# | Holds the subject text, when sending out emails |
#JOB_COUNTER# | If key enabled, then jobs or even any single item can be counted. See description here: Counter |
#LAST_ARCHIVE_FILE# | Path and file name of the last created archive file, independent if in or out data are stored. Can be used in an reporting file if needed. |
#LAST_ARCHIVE_FILE_PDF# | Path and file name of the last created PDF archive file, independent if in or out data are stored. Can be used in an reporting file if needed. |
#LAST_ARCHIVE_FILE_TIFF# | Path and file name of the last created TIFF archive file, independent if in or out data are stored. Can be used in an reporting file if needed. |
#OMR_.... | The Tech Ref OMR does provide the full description of the OMR related variables |
#PAGECOUNT# | Use this variable to generate an automatic page counter, Example: Page counter Note: This counter is reset back to 1 once an UEL command is found in the data stream. Especially if the stream ends with an UEL, this value is always set to 1 This behaviour can be overwritten, using the key: Variable=#RESET_PAGECOUNT#:1 in the rule GLOBAL |
#PAGEPERCOPYCOUNT# | Same as #PAGECOUNT#, but the page counter counts only within a copy. So with the beginning of every copy the counter is reset to page number 1 With ELP_Command usage of K factor the result is 123... 123... etc. with Q it will be 111... 222... 333... |
#PREPARSEPAGECOUNT# | page count as a result of preparsing, is automatically generated when key PreParsing=ON |
#RESET_PAGECOUNT# | VARIABLE=#RESET_PAGECOUNT#:0 Default: If an UEL is found in the PCL data stream, the page counter is reset to 1 VARIABLE=#RESET_PAGECOUNT#:1 If an UEL is found in the PCL data stream and the page counter is even and we are in duplex mode, the counter is incremented by 1. This version should only be used in duplex printing to move to the next odd page number. The same result could be achieved using the key ELP_Cont_Page_Counting. |
#INIT_COMMANDFILE# | Holds the path to the initial convert.ini file. |
#VAR_ACTROWNO# | Is automatically created by ELP when minimum one Search_RowNo command is defined in the configuration file. The Variable holds the actual processed row number can can be evaluated for example during a Search_Binary triggered rule using the keys: TriggerSectionAfterStore or TriggerSection. See Search_RowNo for an example. |
#VAR_ACTCOLNO# | Is automatically created by ELP when minimum one Search_RowNo command is defined in the configuration file. The Variable holds the actual processed column number can can be evaluated for example during a Search_Binary triggered rule using the keys: TriggerSectionAfterStore or TriggerSection. See Search_RowNo for an example. |
#VAR_BARCODE_COUNTER# | How many bar codes are converted during the job execution |
#VAR_ELPCOMMAND_USED# | TRUE/FALSE |
#VAR_FORMSLOAD_COUNTER# | How many forms are loaded during the job exe |
#VAR_INFILESIZE# | file size of input file, or how many bytes have been read (in Blocks of Max_ReadBuffer) when a search_ command was found. |
#VAR_OUTFILESIZE# | For accounting, the variable holds the total written amount of bytes. The volume nearly doubles if the job is reverse printed. |
#VAR_TCPIP_PORT# | Name of printer TCP/IP printer port |
#VAR_ORIENTATION# | Stores the print orientation (portrait, landscape, etc) of the data stream, if defined in the data stream. |
#VAR_PAGESIZE# | Stores the page size (A4, Legal, etc) of the data stream, if defined in the data stream. |
#VAR_PAPERTRAY# | Stores the PCL paper tray number of the first page |
#VAR_RESOLUTION# | Stores the resolution (300, 600, etc) of the data stream, if defined in the PJL section of the data stream. |
#VAR_SIMPLEXDUPLEX# | Stores the simplex/duplex function of the data stream, if defined in the data stream. |
#VAR_UNICODE_CHAR_COUNTER# | |
#VAR_UNICODE_CHARMISS_COUNTER# | |
#VAR_UNICODE_DOLLAR_COUNTER# | |
#VAR_UNICODE_USED# | TRUE/FALSE |
Additional variables for Accounting
#ACC_EDITTEXT# | Special field generated by the accounting via Projects software. It contains standard editable text which can be placed on the print pages |
#ACC_FILE# | Filename usually from ACC_FILE key which contains the file name for the accounting file. |
#ACC_PROJECT# | Name of a project which can be stored into a the accounting file. (Project Accounting) |
#ACC_STOREVALUES# | Variable which holds all the variables, whose content should be stored into the accounting database or file. |
#ACC_TYPE# | Holds the value if the accounting information is written into a .dbf or [Unicode] CSV file. |
#ACCTOTALPAGES# | This is the amount of print pages, provided through the -p5 parameter (In MS Windows automatically done). For PCL data streams the counter is set to 0 and ELP does count all Form Feeds itself. * |
#ACCTOTALCOLOREDPAGES# | Not officially released variable, but does exist and does it best to separate colored from b/w pages. |
Additional counters for Safe Monitored Printing:
#SNMP_TOTALPAGECOUNT# | The actual page counter read back from the printer, before the job starts |
#SNMP_TOTALDUPLEXPAGECOUNT# | Same, but Duplex Page Counter if available |
#SNMP_TOTALCOLORPAGECOUNT# | Same, but Color Pages Counter if available |
#SNMP_JOBPAGECOUNT# | Contains the amount of the printed pages, either at the job end, or until the job is canceled. |
#SNMP_JOBDUPLEXPAGECOUNT# | Same for Duplex Page amount |
#SNMP_JOBCOLORPAGECOUNT# | Same for Color Page amount |
#SNMP_JOBSTATUS# | Contains a string if job was completed successfully or not |
Additional values for Plotter Multiroll support:
#VAR_GL2MAX_X# | Plot X size in mm |
#VAR_GL2MAX_Y# | Plot Y size in mm |
Note: Variables can be overwritten any time, using any method like: Variable=, Variable_File= or StoreNextWordToVariable= etc. It is NOT recommended, but possible. maybe make an own variable in the rule Global and copy the startup variable like:
[Global]
Variable=#MyUSER_NAME#:#USER_NAME#
1.2. Variables can be defined using the key Variable=[#]name[#]:value
Use the ini-files to define any additional variables. This function is for example a perfect way, to differentiate between several companies. If each company prints fixed to the same queue, the printer sections can define the variables for each company, which are used in the forms.
The syntax in the ini-file is:
Variable=#VarName#:VarValue
Notes:
-
The character ':' is the differentiator between the variable name and the value. An empty value is defined, if the line ends with the colon.
-
Variables are case sensitive searched.
-
If a variables is found in macros / forms or in the incoming data stream, they are automatically replaced (Watermarks, Page counter )
-
All read variables are not erased, when a new ini-file is selected (Search and Triggers are erased).
-
Please encapsulate the variable value in "" in order to use blanks at the beginning or at the end of the value.
-
Also the hex notation \x## can be used.
-
If the surrounding # characters in the variable definition: #name# are missing, ELP adds them automatically
-
If you add log_mode=100 (Help) to the default rule GLOBAL and after the process is finished click on the button Debug folder within ELP Control Center, Admin Tab and open the Log_file_<date-time-stamp>.txt within the <printqueue folder>. If line feeds are missing use e.g. Notepad++ for better reading. Then move nearly to the end of the file and you see a listing of all final variables.
-
Variables can be overwritten any time, using any method like: Variable=, Variable_File= or StoreNextWordToVariable= etc. It is NOT recommended, but possible. Preferred: Make an own variable in the rule Global and copy the startup variable like shown at the end of last paragraph.
- Is the content of the variables being read out of the executed rule/section encoded in the Unicode format, please add this key to the same rule: Variable_Encoding=Unicode
Please notice, while replacing within a variables other variables with a mixture of symbol sets, is currently not supported.
Example: VARIABLE=#COMPANY#:" My Company Ltd. \x22Germany\x22" From now on the variable #COMPANY# is searched in the data stream and is replaced with the ' My Company Ltd. "germany"' (without ').
Delete_Variable: This key deletes any, even ELP internal, variable from the memory. Missing # signs are added automatically.
Rename_Variable: Searches for a given variable by its accurate name and replaces the name to a new given one. Missing # signs are added automatically.
Note: The second parameter can be a new variable name as text or an existing variable where the variable value will be used as the new variable name.
Adding ;ON to the term does first replace any variables in the given new name with its values. Please make sure final variable name does not exist.
[GLOBAL]
; Initialize variables
SetTrigger=AllWaysTrue:ON
Variable=#MyNameCounter#:0
[Search Lastnames in a datastream]
Search_Binary=Lastname:
; Read the lastname into a variable
StoreNextWordToVariable=#My_LastName#
; Increase the counter für building an array
Counter=#MyNameCounter#
; Execute next section after reading the lastname
TriggerSectionAfterStore=Add Name to Array
[Add Name to Array]
; Primary Trigger is always true, see rule Global
Trigger_Binary=AllWaysTrue
; Secondary only if variable exists
Trigger_Variable=0<STRLEN(#My_LastName#)
; Rename the variable
Rename_Variable=#My_LastName#:"VarArrayNames(#MyNameCounter#)";ON
; As a result:
; Variable #VarArrayName(1) contains the first read Lastname
; Variable #VarArrayName(2) contains the second read Lastname
; etc.
It is recommended to initialize all own defined variables in the rule GLOBAL. They also can be generated from existing variables, using operators like LEFT, RIGHT, ... operators from existing variables. See further down chapter 2.
Often they are used in a Boolean way to set them e.g. to FALSE, then if some searches come true they are set to TRUE and then later key Trigger_Variable can be used to activate rules on the state of the variable.
1.3. With Search_xxx and StoreNextWordTo[Int]Variable can ELP extract / read nearly any information out of the data stream into variables.
StoreNextWordToVariable The function will read the next word[s] behind the searched item into a provided ELP variable. It is recommended to initialize the variable in the rule GLOBAL with the key Variable. As an option you can specify up to 2 parameters: StoreNextWordToVariable=#MyVariableName#;x;y
By default, the gained word ends with a byte in the data stream which value is below or equal ASCII 32 (e.g. Space, Carriage Return, Line Feed etc.). Any leading bytes are ignored.
The optional x paramter reflects the minimum length of information retrieved. It can be used in any Search_xxx rule variants. With the y value any space between words do not stop the reading.
Examples Search_Binary:
StoreNextWordToVariable=#xxx#
Text: 123 456 789 0ABC DEF
Result: 123
StoreNextWordToVariable=#xxx#;10
Text: 123 456 789 0ABC DEF
Result are 11 characters: 123 456 789
Text: 123 456<CR><LF>
Result: 123 456
Text: 123 456<Esc>&a10H789
Result: 123 456
With Search_Windows PCL positioning sequences between the characters are ignored.
Examples Search_Windows:
Search_Windows & StoreNextWordToVariable=#xxx#;10 (<Esc>&a10H is a PCL positioning sequence which is skipped within Windows)
Text: 123 456 789 0ABC DEF
Result are 11 characters: 123 456 789
Text: 123 456<CR><LF>
Result: 123 456
Text: 123 456<Esc>&a10H789 0ABC DEF
Result are 11 characters: 123 456 789
Text: 123 456<Esc>(10U789 0ABC DEF
Result: 123 456
If the second parameter y is set, the storing is stopped once a byte code below y is found. It can be set to e.g. 32 to ensure that spaces are included.
Example:
Text: 1234 567 890<CR>
Search_Binary & StoreNextWordToVariable=#xxx#
Result: 1234
Search_Binary & StoreNextWordToVariable=#xxx#;;32
Result: 1234 567 890
The y parameter can also be higher like e.g. 65 (ASCII code letter A) in order to stop filling up the variable once no more letter is found.
Example:
Text:
Search_Binary & StoreNextWordToVariable=#xxx#
Result:
Search_Binary & StoreNextWordToVariable=#xxx#;;65
Result: JOHN
The ELP key StoreNextWordToVariableMaxLen=## does end the storage after having ## characters read back from the data stream.
This stored variable can be used later in any form, even to generate variable HPS or archive index files. See chapter archive for further information.
The StoreNextWordToIntVariable reads the next number after the searched item.
If the searched section requests to delete the searched term using the Erase_Binary key, the found next word will also be erased.
Immediately after the variable is read from the data stream, the optional key TriggerSectionAfterStore is checked. Found in the same rule / section, ELP does call the provided rule name. So the variable content can be for example immediately analyzed, and actions taken.
But note, that the trigger analysis is always about Max_ReadBuffer Bytes behind the search analysis. So by default there will be no trigger available until the first 2048 bytes had been read and searched through. You may use the SetTrigger key in rule Global to activate a standard always true binary trigger in such a rule.
ADD_Binary can be used in those tested rules as well, but without ERASE_Binary. In that case the text added will be directly after the searched term and the searched term will contain the added information as well!
The key Add_BinaryAfterStore adds a provided text and/or print commands behind the information, which was read out of the stream. Erase_Binary can be used as well!
In conjunction with the TriggerSectionAfterStore the read information can be analyzed and direct new statements can be replaced or added.
The key TriggerSectionAfterStore can be used X times in the executed Search_xxx rule. E.g. in rule GLOBAL to analyze at startup some already passed information, like print queue or document name etc.
It is recommended to start and end the variable name with the # sign, as otherwise you may lose a significant processing speed.
The optional length indicates the requested minimum length in bytes of the stored item. Requested means, that if the data ends before with an escape sequence (Search_Binary mode) or any other character below ASCII 32, the parser stops reading into variable. In Search_Windows mode the positioning sequences are skipped.
If the length ends in the middle of a word, ELP will continue reading until the end of that word.
[Global]
; init variable
Variable=#OrderName#:Nothing found
[Search for address Line 1]
; After this text in the printed document
Search_Windows=Ordered by:
; There is the name of the person who have ordered the parts we need to store the name to a variable, which may read over all blanks for minimum 20 characters
StoreNextWordToVariable=#OrderName#;20
; Should be only read on time
Search_Only_Once=ON
; Speed up process
ReadOnlySearchKeys=ON
; perform a special rule for Order Name stethos GmbH
TriggerSectionAfterStore=Check for OrderName
[Check for OrderName]
; Primary trigger always true if more than Max_ReadBuffer was read.
Trigger_binary=1
; Now if order name was stethos Systemhaus GmbH
Trigger_Variable=stethos Systemhaus GmbH:#OrderName#
; Do not print
NoPrinting=ON
StoreNextWordToIntVariable= same as above, but Information is supposed to be a valid number, otherwise 0 is stored.
Notes for using the keys StoreNextWordTo[Int]Variable with Search_Windows_New or Search_Text_New triggered rules:
-
Out of the manipulation keys, currently only ADD_Binary, Disable_Search and Search_Only_Once can be used.
-
The search is processed parallel to the Trigger analysis, so after the complete data stream is read. This means, that with StoreNextWordTo[Int]Variable found variables are NOT replaced further down the data stream. But they are in later loaded macros.
-
The command finds search texts coming from the new Windows drivers. The fonts themselves need to be UNICODE based! It might not work with current MS version of Calibri because the TrueType font is not Unicode compliant.
-
It is not guaranteed, that characters above 127 are treated correctly.
-
Does not search in Binary data. Only text and Escape sequences can be searched.
-
The maximum length of read back information is 254 characters
-
The Erase_binary=ON might not work under the following circumstances:
- Downloaded characters are defined right before they are addressed. Load-CharA A Load-CharB B etc.
- When the amount of bytes from the first character to the last may exceed the default Heap value of currently 4048 bytes or the overwritten setting using the ELP key: Max_ReadBuffer
1.4. Variables can be read out of ASCII files
The key Variable_File can read any defined variables from an ASCII file. It is recommended to store the files into the Workpath folder (e.g. c:\ProgramData\WELP) and open them with this key argument: #ELP_FORMS_PATH#ELP_VarsIn.var. You may recognize, that the filename definition of the Variable_File key may contain any previously defines variables. The file name maybe followed by a semicolon and the separator character between the variable name and variable value. Character must be > ASCII 32 (Blank). Character # is not allowed. Default sign is = ASCII 61 (Hex 3D). So the file name can be for example user or printer specific: Variable_File=#ELP_FORMS_PATH##PRINTERNAME#MyVarFile.var.
Together with the key Variables_Store values and information like for example counter can even be passed from the actual data stream to the next one or the any one coming sometimes in, you need the information.
The syntax for reading variables out of an own defined file is:
- One variable per line, VariableName=Value, like: #SURNAME#=Thomas.
- Lines starting with characters below ASCII 33 (= Blank and below) or with @ (ASCII 64) are ignored
- Leading characters in lines below ASCII 33 (= Blank and below) are ignored
- It is recommended to encapsulate the variable with # characters.
- If the variable contend is defined in Unicode, then please use the key: VARIABLE_FILE_ENCODING=Unicode to inform ELP.
Example: A plumping parts distributor has thousands of prices and a huge PageMaker based price list. For each new price list version he needed to sit down and compare 20.000 prices if they changed.
With ELP he just needed to
-
export the prices from his ERP system in an external ASCII variable file, e.g. #ArticleNumber#=price
#20.1234#=12,50 Euro
#20.1235#=13,40Euro -
Modify the PageMaker file, and replace the prices with ELP variables, e.g.#ArticleNumber# (#20.1234#, #20.1235#,etc)
-
Setup the rule to load that price file into ELP:
[PriceListPrinter]
VARIABLE_FILE=#ELP_FORMS_PATH#pricelist.txt
- Print the PageMaker file
The ELP did such a good job, that the client even started to generate client specific price lists. Another example: Send automatically printed copies to a user list.
The key Variables_Store writes all or a pack of named variables back into the provided file name, which may contain any ELP collected variable.
1.5. Reading variables out of the active directory
See here for further details: Reading ELP Variables from Active Directory
1.6. Reading from system environment
The ELP key GetEnvVariable reads any available environment viable into a ELP variable. The variable name is set to uppercase and surrounded by the # characters.
GetEnvVariable=os may lead to an ELP Variable #OS# with the content Windows_NT.
But a #OS# may also be found in the data stream (graphical data) it is recommended to make the variable name longer with: GetEnvVariable=os;MyOSNumber
Type SET in a DOS command window to view the environment settings.
1.7. [Job-] Counters
ELP can also handle counter, which are normal variables. They can be increased or decreased by any amount, once executed in a rule, maybe triggered by a searched argument. A special counter is generated with the key: JobCounter.
An example where similar variables with an own internal counter have to be counted is here: Send automatically printed copies to a user list.
1.8. The Search_RowNo key
Only used in conjunction with ASCII based print files! The key is used to read form a specific page, row and start colon number a text with a certain length into a variable.
1.9. Database variables
After a database file is opened and a special record was searched and found, ELP will read automatically some predefined variables.
The key DB_Variable can then be used to reads a field content from the database.
Notes:
-
ELP searches automatically for the names of the variables in the data stream, as well as in all loaded forms / macros. Once found they are automatically replaced with the current value. So for example a page counter can be inserted while writing the data stream out.
-
A variable name starts and ends usually with the character "#". The name itself is searched case sensitive, in binary and windows mode.
-
Please note, that the limitation for finding the tags in the data stream is the same, as explained in the Search and Trigger key sections.
-
*To ensure, if your requested variables are available, you may also store their latest values at the end of the conversion run into a file. The function is activated if the ini file key VARIABLES_STORE was found in any activated section.
-
You may use the same ELP PCL sequence in order to split a huge incoming data stream in the archive directly into its native documents. See Job Splitting for further details.
2. ELP calculations with the key Variable
Currently ELP supports the following none nestable functions for string manipulations. The Syntax of the case sensitive named functions are:
ASC(#CharVar#) | Returns the ASCII value of the first character of a string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FILECOUNT(#Variable#) Windows systems only! |
Returns the amount of files in the directory named by the provided variable. Notes: a) It is a must to use a variable as an operand, otherwise the function will NOT be executed. b) You may use wildcards in the search expression. Variable=#MyDir#:d:\pp\*.pdf Variable=#MyFileCount#:FILECOUNT(#MyDir#) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FILEEXISTS(#Variable#) | Returns YES or NO depending if the provided file does exist or not.Note: It is a must to use a variable as an operand, otherwise the function will NOT be executed. Variable=#MyOrt#:d:\pp\test.pdf Variable=#MyFileExists#:FILEEXISTS(#MyOrt#) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GETFILENAMES((#Variable#)) Windows systems only! |
Returns a variable table based upon the name of the provided variable. Note: Like the list functions above, the operand must be an ELP variable. The function creates a list of 3 columns: Each set is named like the variable with a counter. The return value is the amount of found files. Variable=#MyDir#:d:\pp\*.pdf Variable=#MyFileListCounter#:GETFILENAMES(#MyDir#) The example above does create those variables: #MyDir# with the name of the searched directory and the file pattern #MyFileListCounter# with the amount of found files for that pattern This table: #MyDir_1# for the first file name, The second is called #MyDir_2# etc. #MyDir_1_path# for the first file name including the full path, The list is continued with _2_ etc. #MyDir_1_old# time in seconds how old the file is between the actual date and time and the file creation time. Continued with _2_ as well. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LEFT(#StringVar#,Length) LEFT(#StringVar#,#IntVar#) |
The functions are only interpreted, if they are set direct in front of a variable and there is a comma direct after the variable followed by the length number and the closing parenthesis. The positive length represents the amount of bytes to be taken out of the provided variable. The amount can be represented another variable. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LOWER(#StringVar#) | Turns all ASCII characters from the variable into lower case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LTRIM | not available, but use STRREP(#StringVar#, ) instead | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MIDSTR(#StringVar#, Startpos,length) MIDSTR(#StringVar#, #Startpos#, #IntVar#) |
Returns a string with the length of Length bytes beginning at stringVariable offset defined in Startpos. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
READVALUEFROMVARFILE("#VariableToFileName#",#StringVar#) | This function reads the value of a named variable out of a variable file. The first operand defines the filename. The complete name needs to be surrounded by two "" double quotes. After the starting ", it is required to define an ELP variable. ELP uses the same routine as the key Variable_File does. So you may add also the option ;DelimiterChar at the end of the file name. The name of the loaded variable is provided in the second parameter. You may use a search string or you can search for the content of a variable. Examples: Variable=#MyEmailAddress#: READVALUEFROMVARFILE("#ELP_FORMS_PATH#eMail.var",Thomas) The variable file content may be: Thomas= Variable=#MyEmailAddress#: READVALUEFROMVARFILE("#ELP_FORMS_PATH#eMail.var;:",#USERNAME#) The variable file content may be: Stefan: |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RIGHT(#StringVar#,Length) RIGHT(#StringVar#,#IntVar#) |
The bytes are taken from the right side of the evaluated string. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RTRIM(#StringVar#) | Eliminates all right handed blanks from the variable content. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
STRLEN(#StringVar#) [-IntegerValue] +IntegerValue] [-#ELPVariable#] [+#ELPVariable#] | Return the length of a string variable. You may add or subtract and constant value to the returned value by adding the value with plus or minus direct behind the ). Examples: The content of the #Variable# is ?Hello World? STRLEN(#Variable#) -> 11 STRLEN(#Variable#)-6 -> 5 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
STRPOS(#StringVar#, #SearchVar#) [-....][+....]
|
Returns the first position minus 1 of the first character of the #SearchVar# string found in the #Variable# string. If the string could not be found then function returns zero. Leading blanks can only be searched if the search text is surrounded be double quotes. The command can follow a plus or minus calculation, without blanks! See STRLEN() command. Examples: The content of the #Variable# is "Hello World" STRPOS(#Variable#," ") -> 5 STRPOS(#Variable#,"World") -> 6 Assume content #SVar# is "World?" STRPOS(#Variable#,#SVar#) -> 6 Assume content #SVar# is " " (a blank) STRPOS(#Variable#,#SVar#) -> 0 Assume content #SVar# is " World" STRPOS(#Variable#,#SVar#)+4 -> 10 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
STRREP(#SearchedStr#, #SearchString#, #ReplaceString#, #StartPos#, #Repeat#); |
The function STRingREPlace is a very powerful function to search for substrings and replace or erase them completely complete.
For the example table below the searched string in variable #A# is always:abc1234abc 56 78abc
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
UPPER(#StringVar#) | Turns all ASCII characters from the variable into upper case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Math calculations | +;-;*;% are performed with the key Counter. Please note that in an activated rule first all variable keys are performed and after that the Counter key. Example: Variable=#MyInteger#:10 Counter=#MyInteger#;*2 Variable=#MyResult#:#MyInteger# ; As a result the value #MyInteger# -> 20 but #MyResult# -> 10 To fix that: [Calculation Part 1] Trigger_Binary=1 Variable=#MyInteger#:10 Counter=#MyInteger#;*2 [Calculation Continued Part 2] Trigger_Binary=1 Variable=#MyResult#:#MyInteger# ; Now #MyResult# -> 20 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Indirect access to variable values | Variable=#VariableName1#:Value of VariableName1 Variable=#Value of VariableName1#:Value of Value of VariableName1 Variable=#VariableName2#:##VariableName1## As a result the value of #VariableName2# is treaded by the sover like this: 1st step: Variable=#VariableName2#:##VariableName1## 2nd step: Variable=#VariableName2#:#Value of VariableName1# 3rd step: Variable=#VariableName2#:Value of Value of VariableName1 Actually the same as using this definition: Variable=#VariableName2#:#Value of VariableName1# Anyway, here the value of 1 could be read out of the data stream, and the real searched value for example can be loaded from a variabel file. E.g. A customer number is read from the stream and the needed amount of copies from an ascii file. (See also database examples) |
Some examples:
String manipulation:
[GLOBAL]
; Whatever you need
; define the starting variables
Variable=#MyStringVar#:1234abcdef GHIJKL56789
Variable=#MyIntVar#:5
; Examples:
; Result in #MyASCResul1t# is "49"
Variable=#MyASCResult1#:ASC(#MyStringVar#)
; Result in #MyLeftResul1t# is "1234"
Variable=#MyReftResult1#:LEFT(#MyStringVar#,4)
; Result in #MyRightResult2# is "98765"
Variable=#MyRightResult2#:RIGHT(#MyStringVar#,#MyIntVar#)
; Result in #MyDummy# is "10"
Variable=#MyDummy#:STRPOS(#MyStringVar#," ")
; Result in #MyLeftResult2# is "1234abcdef"
Variable=#MyLeftResult2#:LEFT(#MyStringVar#,#MyDummy#)
; Result in #MyStrLenMinus2# is "20"
Variable=#MyStrLenMinus2#:STRLEN(#MyStringVar#)-2
; Result in #MyStrLower# is "1234abcdef ghijkl56789"
Variable=#MyStrLower#:LOWER(#MyStringVar#)
; Result in #MyMidStr# is " GHIJKL56789" including blank
Variable=#MyDummy#:STRPOS(#MyStringVar#," ")
Variable=#MyMidStr#:MIDSTR(#MyStringVar#,#MyDummy#,100)
[Warranty Text printing]
; Find the place to print the info in the data stream
Search_Binary=!WarrantyStatement!
; Replace with text and variable #NextYear#
Replace_binary=This part has warranty up to end of #NextYear#
; Which was calculated from the date code dd.mm.yyyy
variable=#ThisYear#:RIGHT(#DATENUM#,4)
; And incremented by one
Counter=#ThisYear#
[Global]
; For that example preset a variable
Variable=#MyVar#:123
; Make sure a primary trigger is always true (Character 1 is always found in data stream)
SetTrigger=1:ON
[Make sure variable is 10 bytes long]
; Primary trigger always true
Trigger_Binary=1
; If secondary trigger variable length is less then 10 bytes
Trigger_Variable=STRLEN(#MyVar#)<10
; Then insert a leading zero
Variable=#MyVar#:0#MyVar#
; and redo the rule until the length is 10 or more
NextTriggerRule=Make sure variable is 10 bytes long
[Global]
; Preset the trigger variable to be empty
Variable=#MyVar#:""
; and make sure that the primary trigger (Character 1) is always marked as found
SetTrigger= 1:ON
[Search for a special text in the data stream]
Search_Binary=My specialtext
; Mark variable as found
Variable= #MyVar#:Found
[trigger when MyVar did change]
; Prinary Trigger always true
Trigger_Binary=1
; and if secondary is also true:
Trigger_Variable= 1<STRLEN(#MyVar#)
; The make 2 copies
ELP_Command= K2;
; Otherwise this ruleis becoming automatically true
ElseTriggerActivateSection= Do else Rule
[Do else Rule]
; is automatically becoming true when above rule is false
; make 3 copies
ELP_Command= K3;
[Global]
ELP_Command= K3;
[Search for a special text in the data stream]
Search_Binary=My specialtext
ELP_Command= K2;
Notes:
-
Currently ELP dos not support to combine several of those function like UPPER(LEFT(#Variable#, 5)). In this case use to command lines:
Variable=#MyTempVar#:LEFT(#Variable#, 5)
Variable=#MyTempVar#:UPPER(#MyTempVar#) -
Error: Will not work
[Named Section as the user logon name]
Variable=#FullUserName#:UPPER(Mike Miller)
Results into the variable content: UPPER(Mike Miller). The name string is not converted, as it is no variable!
This will do the job:
Variable=#FullUserName#:Mike Miller
Variable=#FullUserName#:UPPER(#FullUserName#)
Hint:
- If you add log_mode=100 (Help) to the default rule GLOBAL and after the process is finished click on the button Debug folder within ELP Control Center, Admin Tab and open the Log_file_<date-time-stamp>.txt within the <printqueue folder>. If line feeds are missing use e.g. Notepad++ for better reading. Then move nearly to the end of the file and you see a listing of all final variables.
-
Use key variables_store for a listing of all collected ELP variables.
3. Performing mathematical calculations using the key: Counter
Counter | Every time a section/rule is activated through a SEARCH_ key (not Search_RowNo) and this COUNTER key is defined, the provided variable is incremented by default by 1 or any other positive/negative value which can be added after as semicolon |
Counter=#VariableName#;*5 Does multiply the value of the variable: #VariableName#
Examples: Counter and generate a counter loop. Perform math calculations.
4. Calculations with Trigger_variable
Trigger_Variable |
Compare any collected ELP variable to a given value. The value and the variable name is separated by |
Trigger_VariableSubString | Like the Trigger_Variable Operator :. But instead of an equal comparison, the key becomes true, if the right argument can be found in the left string. The search is case in-sensitive performed. |
See for an counter loop example right here.
5. Calculations with Check_TelNo
This function does erase all non digit characters out of the content of the named variable. A + at the beginning is turned into 00. Example: +49 (7031) 860910 is turned into 007031860910
How Variables can be used:
-
generate a counter loop
Related articles: Rule assistant, Search within data stream, Special keys for Searched rules, Trigger Rules, Special keys for triggered rules, Triggering rules with hierarchy