Primary and Secondary Triggers

As most Search_xxx keys are directly performed, when ELP reads the data stream in, all Trigger_xxx and the Search_xxx_New commands are executed after the data stream is fully read or alternatively for big streams, after ELP did read up to the amount of bytes provided with the ELP_MAX_HEAP key. One fact is that you can't use any of the search related commands like Add_Binary, Insert_Binary etc commands in a rule, activated by Trigger_xxx commands.

Also if more than one Trigger_xxx key is provided in a rule, they all must be evaluated as TRUE, before the rule is executed. If only one trigger is not fulfilled, the rule is NOT executed. In this case the key ElseTriggerActivateSection could be used to direct en ELP path section..

In order to increase processing speed, ELP does have two different categories of Trigger command:

  • Primary triggers: Those triggers need to be TRUE before any secondary trigger is analyzed.
  • Secondary triggers: Those triggers are more specific to the environment of the data stream, so if page size fits or a variable contains a certain information

Even if your rule is only based upon the verification of secondary triggers, you need to use a least on primary trigger and make it true. This can be done with a key like that: Trigger_Binary=1. As in nearly every data stream the digit 1 can be found, this primary trigger will always be true. if you doubt that, the set in the rule GLOBAL the key SetTrigger=ThisPrimaryTriggerKeyIsAlwaysFound:ON and the ELP rule analyzer will always determine the character Text ThisPrimaryTriggerKeyIsAlwaysFound and existing in the data stream.

These are the primary triggers:

TRIGGER_BINARY (primary)

It is recommended to let PPAdmin decide which Search_xxx function is best to be used: New rule/section. This command is pretty much the same as Search_Binary , but

  • The ADD_BINARY; INSERT_BINARY; REPLACE and ERASE_BINARY are not usable.
  • Several TRIGGER_xxx keys in one section are analyzed as an AND operation. In other words, all trigger needed to be found in the data stream, before the further control commands of this section are performed.
  • If all primary triggers of a section are found to be true, additional analysis for secondary triggers are performed, like page size, orientation or the content of collected variables and existing and they are also all true, the defined actions of the rule are performed.

Do not use this key in the section GLOBAL or any other named rule like e.g. PrinterName or UserName

 

[Section TRIGGER SAMPLE, if 2 triggers are found]

TRIGGER_BINARY=Rechnung
TRIGGER_BINARY=Hausanschrift

; if both words are found in the actual data stream then print 3 copies

ELP_COMMAND=K3;C1F1000;C2F1100;D2

; End the ini file analyzing when both are found, so if only one if found use next rule...

Exit=ON

[Section TRIGGER SAMPLE, if only one is found]

TRIGGER_BINARY=Rechnung

; if just this one is found in the actual data stream then print 2 copies

ELP_COMMAND=K2;C1F1000;C2F1100;D2

TRIGGER_TEXT (primary)

It is recommended to let PPAdmin decide which Search_xxx function is best to be used: New rule/section .

This command performs the same functionality as the TRIGGER_BINARY key, but with 2 enhancements;

  1. The comparison between the searched text and the data stream text is performed case insensitive

    Example: TRIGGER_TEXT=Greta Garbo will be true for all following data stream contents: Greta Garbo; greta garbo; Greta GARBO etc.
  2. In addition this key ignores any positioning Escape Sequences (Esc*p#X or Esc*p#Y), the windows driver might generate between each printed character. Here are some tips to make the trigger findable in the data stream, especially if you are not able to interpret a PCL data stream:


TRIGGER_WINDOWS (primary)

It is recommended to let PPAdmin decide which Search_xxx function is best to be used: New rule/section .

This command performs the same as the Trigger_Text key, except the comparison argument is performed character case sensitive.


TRIGGER_WINDOWS_NEW (primary)

It is recommended to let PPAdmin decide which trigger_xxx function is best to be used: New rule/section .

This command performs the same as the Trigger_Windows key. However a smarter routine tries to come around the behavior of newer PCL5 Windows drivers, which do not send a characters using its ASCII value. This key can work together with TrueType fonts which are defined in the UNICODE Symbol set. Read more about this here.

Normally the Search_xxx_New is ended by the end of line or just a Y position command is found. If the key TriggerNewYPosMode is turned on, the Y position sequence does not end the search.

Arial, Times New Roman and Courier New are Unicode based fonts! If the Unicode table is not maintained in the font, this trigger key can't work.

Also note that it is not possible to search for Trigger_xxx_New expressions in compressed or encrypted data streams. In that case you may decompress / de-encrypt the stream first and then run it a second time through ELP.

PCL5 escape sequences and parts of such are skipped by this trigger. If you want to trigger with a PCL5 sequence please use Trigger_Binary.


TRIGGER_TEXT_NEW (primary)

It is recommended to let PPAdmin decide which Trigger_xxx function is best to be used: New rule/section .

This command performs the same as the Trigger_Windows_New key, but case insensitive.

Those are the secondary triggers:

Those keys are an extension to the primary TRIGGER_xxxx keys. An example which demonstrates how to put automatically a logo on the printed page depending upon the page size and orientation is listed at the end of this chapter.

IMPORTANT: Those keys are only analyzed, if all TRIGGER_xxxx keys of the section were found in the data stream. This means, if the real main trigger you are looking for is one of those secondary keys, then you need set in the section/rule a TRIGGER_xxxx statement, which becomes always true, for example such as TRIGGER_BINARY=1.

If one or even more of those triggers are used in the ini-file (Orientation, Page_Size, PaperTray, Printer_Names, Resolution, Simplex_Duplex) in order to trigger upon certain print job settings, but the proper information is missing in the data stream, ELP reads the default setting from the "Printer Settings" section of the actual ini-file. Make sure that those ini-file settings match to your printer menu settings.

PCL5 escape sequences and parts of such are skipped by this trigger. If you want to trigger with a PCL5 sequence please use Trigger_Binary.

The total key is ignored, if it was not possible to determine the appropriate setting in the data stream. Those secondary keys are:


Triggger_Variable
(secondary)

Compare any collected ELP variable to a given value. The value and the variable name is separated by ":", "!", ">" or "<". Notes: You may define the variable in the section GLOBAL, to have a predefined value.
Operator ":" does compare strings 1:1
Operator "!" is true if the two strings are not identical
Operators ">" and "<" are comparing two float numbers.
In addition those manipulation commands can be used (LEFT, RIGHT etc)

Trigger_Variable=#MyValue#:test
Trigger_Variable=LEFT(#MyValue#,2):te
Trigger_Variable=#MyCounter#>7


Triggger_VariableSubString (secondary)

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.

; check if a blank is in the value of the variable #MyValue#

Trigger_VariableSubString=#MyValue#:" "

You may also use this command to search if a variable / text is in a list.
Example: Extract the SAP user name from job title and reroute the job to another printer

Orientation* (secondary)

Orientation=LANDSCAPE or Orientation=1

PORTRAIT, REVERSEPORTRAIT, LANDSCAPE, REVERSELANDSCAPE You may also set integer value 0 (= Portrait) up to 4 (= reverse Landscape)

Page_Size (secondary)

Page_Size=A5 or Page_Size=26

A5, A4, A3, Letter, Legal, or PCL 5e value of the Esc&l#A command.

PaperTray (secondary)

PaperTray=4

PCL5e value of the Esc&l#H command. See "PC 5 technical reference" or "PCL5 printer comparison guide" for further details.

Trigger_OutPrinting (secondary)

Used in conjunction with the database. Trigger a Section after the database inquiry and check if the job is still to be printed or not.
This secondary trigger is used for example to react if a job is not printed anymore, but maybe only emailed of faxed. So new copy factors or archive rules can be applied.

Printer_Names * (secondary)

Printer_Names=;printer name 1;printer name 2;

Check becomes only true, if job arrived through one of the named printers

Resolution (secondary)

Resolution=600

300, 600

Simplex_Duplex (secondary)

Simplex_Duplex=0

simplex 0, Duplex long side 1 and duplex short side 2

User_Names * (secondary)

User_names=;name 1;name 2;name...;

Check becomes true, if job is initiated by one of the named users (logon name)

*User and Printer names are separated with semicolons. The command argument must also begin with a semicolon. The trigger is true, if one of the entries is found. The entries are case sensitive compared against the program call arguments
-P1Argument (printer_names) and the -P3Argument (user_names). If no command call arguments are provided, the trigger is always true.

Sometimes it an be useful to know if an item can be found in a list, there are keys which does that: Printer_Names( or User_Names*. Those commands can for example be also performed with the Trigger_VariableSubstring key. Example:

a) Printer_Names=;QueueA;QueueB;QueueC;
This trigger key is true, if the default variable: #PRINTERNAME# holds one of those 3 listed names

b) Trigger_Variable=0<STRPOS($QueueA$QueueB$QueueC$,$#PRINTERNAME#$)
Does exactly the same as a). Note the $ sign is used to separate the list and as the searched text (#PRINTRENAME#) has to be unique, the searched text is also surrounded by $ signs.

[Printing color is allowed for user]

; In every job is a character 1, to the first trigger is always true

Trigger_Binary=1

; Primary trigger above is always true!

user_names=;USER1XP;USER2NT;

; Now second trigger, check is the job was submitted from a user, who is allowed to print color

PlanesInUse=1

; See also ELP Command C1 and C2


More ELP keys related to rules activated by Trigger_xxx keys

ElseTriggerActivateSection

This key is performed if a triggered section does not become true. As the key argument any section name can be used. This section will be evaluated in the same way, as it would have become true using a search or trigger key. See Question/Answer 41 in the QA document for a nice example.

[Printing color is allowed ?]

Trigger_Binary=1

user_names=;USER1XP;USER2NT;

; Those view folks are allowed to print color

ElseTriggerActivateSection=Don`t allow color printing

[Don`t allow color printing]

; all the other ones are not allowed.

; note; this is NOT a triggered section, as it is activated in the ELP path from above automatically

PlanesInUse=1

NextTriggerRule

Analyze this rule named next. If rule does not exist, then the ELP ini file analysator simply continue with the next rule/section.
This function can be used to generate loops, as triggered rules are executed from top to buttom through the ini file. And after that rule is analysed the next rule after this one is analysed [maybe again].

A theoretical example:

[Global]

; Initialisation

Variable=#MyCounter#:6

; Initialize the ELP_Command to one copy

ELP_Command=K1;

; make sure, that the variables are replaced in the ELP_Command as soon as the command is defined

ELP_Replace_Variables=ON

[Run this rule 5 times]

; Primary trigger must be always true

Trigger_Binary=1

; secondary trigger only true as long as counter is larger 1

Trigger_Variable=#MyCounter#>1

; Reduce counter by one

Counter=#MyCounter#;-1

; prints first 5 pages with form 1000;

ELP_Command_Add=C1:#MyCounter#F1000;

; This rule could be reduced like this: ELP_Command=C1-5F1000;

; now run again until counter us less then 2.

NextTriggerRule=Run this rule 5 times

TriggerSection

The difference to the last key, this key will ONLY evaluate the named rule. Meaning if the kommand is used during the trigger key analysation, the named rule is analysed and then ELP will continue with the next rules from where the process ahd been.
This key can also be used in searched or automatically executed sections.

Another theoretical example, which kills all jobs from a named user coming form MS Word:

[Global]

; Set the searched item character 1 to found, so the primary trigger key in the last rule is always true

SetTrigger=ThisPrimaryTriggerKeyIsAlwaysFound:ON

[USERNAME]

; The rule must be named according to the logon name of the user, that it is executed right at the beginning of the process

TriggerSection=Check if MSWord

[Check if MS Word]

; Primary key always true

Trigger_Binary=ThisPrimaryTriggerKeyIsAlwaysFound

; and the job name starts with Microsoft Word -

Trigger_Variable=LEFT(#PRINTDOCNAME#, 16):Microsoft Word-

; Then

KillJob=ON
Exit=ON

Note: That in that exampel every job from that application will be killed, as later when the trigger rules are executed the condition is hit again. So you might add a rule in front, which exits the trigger interpreter. So the better implementation but needing more CPU time is:

[Check if MS Word and user]

; Primary key always true

Trigger_Binary=1

; and the job name starts with Microsoft Word -

Trigger_Variable=LEFT(#PRINTDOCNAME#, 16):Microsoft Word-

; and the special user

User_names=;USERNAME;

; Then

KillJob=ON
Exit=ON

ActivateSection

In order to generate common functions in one rule/section ELP can call from any Searched or triggered section another section, where for example those common settings are performed:
Here an example which stores the delivery notes and invoices into the same archive.

[Invoices]

Trigger_Windows=Invoice No:
ELP_Command=K2;C1F500;C2F500F300;
ActivateSection=ArchiveJob

[DeliveryNotes]

Trigger_Windows=Delivery No:
ELP_Command=C1F500;
ActivateSection=ArchiveJob

[ArchiveJob]

OutArchiveDir=D:\Archive

SetTrigger

This key can turn a Trigger_xxxx argument either to ON (= found) or to OFF (= not yet found).

Example: If the printed document has a specific name, here "MyApplication.doc" then do something very special and exit.

[GLOBAL]

; Set primary trigger below to ON

SetTrigger=ThisPrimaryTriggerKeyIsAlwaysFound:ON

; Execute the next rule directly before any bytes form data stream are read

TriggerSection=Check at the beginning for special document name

[Check at the beginning for special document name]

; Primary trigger is always turned on, as set in rule GLOBAL

Trigger_Binary=ThisPrimaryTriggerKeyIsAlwaysFound

; Check Secondary trigger

Trigger_Variable=#PRINTDOCNAME#:DocNAME

; if true then call the job ticketing routine

CALLATSTARTUP=C:\programme\WELP\Job_Ticketing.exe -P1#PRINTERNAME# -P2#PCNAME# -P3#USERNAME# -P4#PRINTDOCNAME# -R#IN_ELP_FILENAME#.uuu -c#ELP_FORMS_PATH#ticket.ini

; and exit the rule interpreter

Exit=ON

[Other rules]

. . .

See here for more samples: Triggering rules with hierarchy, Special keys for searched rules