Q: I know the following can be done by setting up 2 or more queues, but can ELP select the input trays (original and copy) and output bin, with trigger data from the spool file i.e. if "Invoice" is found, Original from Tray2, Copy from Tray3, Output to Bin1 if "Check" is found, Original from Tray4, Copy from Tray5, Output to Bin2

A: You can setup as many rules as you like. The rules are processed in this order

ELP offers those options to perform any rules, listed in the appearance flow through the ELP process:

After every step you can exit the process using the key EXIT=ON which does end the rule interpretation immediately

So the only question is what can be found first in the data stream. Here in our example at first the term invoice is checked:

Example 1: Using ELP_Command search and trigger

A possible ini-file could look like that:

[Global]

; print on every page the company logo 502!

ELP_Command=C1F502;

[Search for term invoice no:]

SEARCH_WINDOWS_New=Invoiceno:
ELP_COMMAND=K3;C1....

; If that term is found overwrite ELP_Command from rule global and do this, always -> exit

Exit=ON

[Trigger for delivery note]

Trigger_WINDOWS_New=Deliveryno:

; Only if it is no invoice and it is a delivery note then

ELP_COMMAND=K2;C1....

Notes:

  • You may even swap the sections! This will not change the result, as search keys always come first if found, and ELP will stop the data stream evaluation if found.
  • Even instead of SEARCH_WINDOWS_new you can use TRIGGER_WINDOWS as well, as in this example the top trigger is evaluated first. But then the rowing of the rules are maybe important
  • If an ELP_Command is located in the data stream itself, it overwrites the commands form above at any time! See option 6 above.
  • If both commands will be changed to Search_xxxx, then the result is exactly the same

Example 2: Search 2 slightly different strings

[Search 1]

SEARCH_Binary=123

; do something

[Search 2]

SEARCH_Binary=12345

; do something

The second rule is never found, even in the data stream is the term 12345 available, as always the first searched item is found and executed. After that the next searches are reset for searching
Even if the rules are switched the result is the same (Note for Search_xxx rules: what is first found in the data stream, its rule is first executed. Beside Search_xxx_New. Those are executed after the data stream is read in).

Example 3: Same as above, but now 12345 has a higher priority

[Search 1]

SEARCH_Binary=123

; do something

[Search 2]

Trigger_Binary=12345

; do something

.As trigger keys are evaluated after the data stream is read in and all Search_xxx had been performed.

Example 4: Search for several information in the stream

[Trigger 1]

Trigger_Windows=InvoiceNo:

; do something

[Trigger 2]

Trigger_Binary=InvoiceNo:

Trigger_Binary=Copy

; do nothing

PassThrough=ON

The rowing of those 2 rules are NOT important, as once the job is set into do nothing mode (PassThrough=ON) you may define any stuff in the first rule, it will not be executed, beside Archive and Job Distribution commands.

Example 5: Nearly same as above, but

[Trigger 2]

Trigger_Binary=InvoiceNo:

Trigger_Binary=Copy

ELP_Command=K3;

[Trigger 1]

Trigger_Windows=InvoiceNo:

ELP_Command=K2;

Here trigger 1 has a higher priortity, as even when rule trigger 2 is true and 3 copies are set, the next rule does overwrite that in any case.
Solutions:
1. Switch the rule positions, or
2. Add to rule 2 the EXIT=ON key.

The same problem coming form a real customer request:


Q: I have to make by default certain forms on a left and right handed page. One exception is the document ARBETSORDER. There I have to differentiate 2 cases:
Only the word ARBETSORDER and the same word together with the text 975-LINV-VAREN. The customer wants to add another ELP-Command for using different forms on the fist page of copy 1 and copy 2:

Solution 1:

[GLOBAL]

.....
ELP=ON

; default command for left and right pages for all jobs.

ELP_COMMAND=C1:RPL-100S1F1101I1FF;C1:LF2101;D1;

[1. analyzed rule: ARBETSORDER with 975-LINV-VAREN]

; This rule triggers both phrases

Trigger_Binary=A R B E T S O R D ER

Trigger_Binary=975-LINV-VAREN

; if they are found make the command, In this case the provided ELP_COMMAND is extended using the ADD version of the command.

ELP_COMMAND_Add=K2;C1:1F1107;C2:1F1105F1106;

; End of rule interpretation

EXIT=ON

[2. analyzed rule: ARBETSORDER]

; This one is only performed if the last rule is FALSE, this is why it is located after the previous rule

Trigger_Binary=A R B E T S O R D E R
ELP_COMMAND_Add=K2;C1:1F1105;C2:1F1105F1106;

Solution 2: just in case more rules need to be checked after that decision, e.g. for archiving etc, an ELP variable can be uses as a semaphore

[GLOBAL]

.....
ELP=ON

; default command for left and right pages for all jobs.

ELP_COMMAND=C1:RPL-100S1F1101I1FF;C1:LF2101;D1;

; Predefine an ELP variable named # VAR_LINV_VAREN_FOUND # and set it to false.

VARIABLE=#VAR_LINV_VAREN_FOUND#:FALSE

[1. analyzed rule: ARBETSORDER with 975-LINV-VAREN]

Trigger_Binary=A R B E T S O R D ER

Trigger_Binary=975-LINV-VAREN

ELP_COMMAND_Add=K2;C1:1F1107;C2:1F1105F1106;

; Set the variable to true that both arguments are found

VARIABLE=#VAR_LINV_VAREN_FOUND#:TRUE

[2. analyzed rule: ARBETSORDER]

Trigger_Binary=A R B E T S O R D E R

; and above rule was NOT executed

Trigger_Variable=#VAR_LINV_VAREN_FOUND#:FALSE

; Then perform this rule.

ELP_COMMAND_Add=K2;C1:1F1105;C2:1F1105F1106;

[2. analyzed rule: ARBETSORDER]

Trigger_........

Example 6: Search for several information

[Search]

SEARCH_Binary=123

SEARCH_Binary=456

SEARCH_Binary=789

; do something

Here the rule becomes true if 123 OR 456 OR 789 is found. It maybe becomes several times true, if 2 are found.
It is absolutely the same result, when for each search is a unique rule:

[Search 1]

SEARCH_Binary=123

; do the same thing

[Search 2]

SEARCH_Binary=456

; do the same thing

[Search 3]

SEARCH_Binary=789

; do the same thing

Example 7: Search only once

[Search]

SEARCH_Binary=123

; do something, e.g. create an archive or send with OutPort the stuff to another queue

SEARCH_Only_Once=ON

Tip: If you need to search for the second (X) time the term appears then make two (X) rules with the same search argument, and ELP will find the terms in the order they are listed in the ini file, from top to bottom.

Example 8: Increase performance

Search_xxx can be enhanced in performance with the key ReadOnlySearchKeys=ON, if the rule just needs to perform those commands: erase_binary, insert_binary, add_binary, remove_binary, Add_AtNextLine or storeNextWordTo[Int]Variable

[Search]

SEARCH_Binary=123

Replace_Binary=456

; if only erase, insert, add or storenextwordto is needed

ReadOnlySearchKeys=ON

Example 9: ERROR! Generate a indefinite loop, which never ends:

Be careful with search commands, you should not use in the Add, Insert or Replace commands the same term again, as ELP processes the search recursive.
Search_Binary: So either you need to change the searched argument a little, inserting for example in the text the PCL code \x1B&a+0H, which does absolutely nothing. Problem: Search_Windows does ignore that sequence, so you may use \x1B&fs1S like push and pop cursor.
Another way is just searching only once.

[Search 1]

SEARCH_Binary=123

Replace_Binary=123456

; Above use Add_Binary!

Search 2]

SEARCH_Binary=123

Replace_Binary=456123

; Above use Insert_Binary!

[Search 2]

SEARCH_Binary=123

Replace_Binary=456123789

; If something before and after is needed you need to modify the text a little
; Replace_Binary=4561\x1B&a+0H23789,

; or add Search_Only_Once key to rule.

To prevent ELP form indefinite loops, use the key: OutFile_MaxLen to maximize the written bytes out.

Example 10: Use secondary trigger

ELP does have primary and secondary trigger. This is a historic fact, used for increasing the process speed. However, often only secondary triggers are the ones needed to be checked. E.g. the content of a variable or a value of a special key, like simplex or paper size or print queue name.
In those cases, you need to make the primary trigger to be always true:

[Global]

SetTrigger=This primary trigger is always true:ON

[trigger simplex]

Trigger_Binary=This primary trigger is always true

; and if is a simplex job

Simplex_Duplex=0

; set it to duplex

ELP_Command=C1:1S1;

Example 11: Evaluate trigger conditions at the time a searched rule is executed:

ELP does have primary and secondary trigger. This is a historic fact, used for increasing the process speed. However, often only secondary triggers are the ones needed to be checked. E.g. the content of a counter or the value of a before searched variable, like simplex or paper size or print queue name.
In those cases, you need to make the primary trigger to be always true:

[Global]

SetTrigger=This primary trigger is always true:ON

Variable=#MyInvoiceNo#:0

; it is always good to initialize variables, which are later used.

[Search for the invoice Number]

Search_Windows=Invoice no

; and read the next term into a variable

StoreNextWordToVariable=#MyInvoiceNo#

; and then directly find out, if it is a special internal invoice number

TriggerSectionAfterStore=Is this an internal invoice?

[Is this an internal invoice?]

Trigger_Binary=This primary trigger is always true:ON

; and if the invoice number starts with 000

Trigger_Variable=000:LEFT(#MyInvoiceNo#,3)

; then set duplex

ELP_Command=C1:1S1;

; and use another ini file

IniFile=#ELP_FORMS_PATH#InternalInvoice.ini

This example makes only sense, if for example other searches have to be performed for internal invoices then for the rest.

Another example is maybe to increase a counter, and if found the 10th time, do something

[Global]

SetTrigger=This primary trigger is always true:ON

Variable=#MyCounter#:0

[Search for the word confidential, case insensitive]

Search_Windows_text=Confidential

; and increase the counter

Counter=#MyCounter#

; and then directly find out, if it is a special internal invoice number

TriggerSection=Is confidential 10 times found?

[Is confidential 10 times found?]

Trigger_Binary=This primary trigger is always true:ON

; and if the invoice number starts with 000

Trigger_Variable=#MyCounter#>9

; and use another ini file, even you can continue to increase the counter in that new config file

IniFile=#ELP_FORMS_PATH#Confidential.ini

Example 12: Conditioned Color Management

How to setup the ini file allowing color printing to only one user (e.g. Administrator), all the other just B/W.

[GLOBAL]

; Set PJL Command for B/W printing, even when print data is color. This command set all color jobs to be printed in gray.

PlanesInUse=1

; If your printer does NOT support that command, then please use the ELP_Command to print gray:
; ELP_Command=C1C2;

[Administrator]

; User with the logon name Administrator is now allowed to print in color. As the rule "User Name" is executed after the rule Global

; The Command is overwritten (Rules theory, how to trigger them)

PlanesInUse=1

; If your printer does NOT support that command, then retest the ELP_Command by just telling print 1 copy:
; ELP_Command=K1;

See also here: Don't print in color when printing from Outlook

Example 13: The exact same example as above, but

executed at the end of the rule analyzation process, when all data is read and maybe other actions are already performed. And ELP uses one Rule to allow more user to print color

[Trigger for User Administrator]

; the next main trigger is always TRUE and needed for the real trigger

Trigger_Binary=1

; The real secondary trigger (this is case sensitive!!!)

User_Names=;Administrator;Thomas;Stefan;Steven;

; Note: TRIGGER_ keys must all be true before ELP continues with the
; Search and evaluation for secondary triggers.
; Setting 0 is ok, as it is ignored in the actual version and color is kept

PlanesInUse=1

ElseTriggerActivateSection=Print all in gray

[Print all in gray]

PlanesInUse=1

Remarks:

  • Use the ELP:Command as indicated above if your printer does NOT support the PlanesInUse PJL command
  • The last 3 lines could be erased, if the key PlanesInUse=1 is set in the global section
  • You may also check the active directory if a user is allowed to print color
  • or maybe with an ELP database?
  • If the rule is just for an application, see how the driver is going to get the job name in the spool file and change the trigger command to this name Trigger_Binary=​@PJL SET JOB NAME="xxxxx

 

Related articles: Special keys for triggered rules, Special keys for searched rules, Variables in ELP, Counter, Rules theory, how to trigger them