Function Key Pattern2



This setting overrides the pattern Genie uses to detect function key labels on screen when creating links/buttons for function keys.

By default Genie decides that a field is a label for a Function Key if the contents of an output field match a certain pattern. For instance a label for the F3 key is detected if the field begins with F, CF, CK, CA, CMD followed by 03 or 3 followed by '-' or '='.

A configuration option, pui["function key pattern"], was introduced in Profound UI Version 5, Fix Pack 1.2 to allow custom patterns for detecting function keys. That option works well if the label is in a single output field and if there are no spaces before the key number or separator character (- or =).

This configuration option, pui["function key pattern2"], addresses the limitations of previous pattern detectors:

  • Labels are detected if the text is output in up to 4 output fields.

  • Labels can have spaces before and after the key number and separator character.

When a label is output from your 5250 session in 2, 3, or 4 output fields, those output fields are merged in Genie as a single output field. This happens before the regular pui["function key pattern"] detector or the original Genie pattern detector are run.

pui["function key pattern2"] can be used along with pui["function key pattern"].



The pattern must be a regular expression with 4 capturing groups in this order:

  • Group 1 contains the key prefix: F, CA, CMD, etc.

  • Group 2 contains the key number: 1, 01, 12, 22, etc.

  • Group 3 contains the separator character: -, =, :, etc.

  • Group 4 matches part of the key description: Continue, Next, etc.

The fourth capturing group only needs to match part of the description text. For example, if the text is "F13=Information Assistant" and the string "Information Assistant" is in a single output field, then the detector will see "Information Assistant" as the key description.



Example 1:

pui["function key pattern2"] = "(F|CA|CF|CK|CMD|CM) ?([0-9]{1,2}) ?([=:-]) ?(\\S+)";

The pattern detects function key labels starting with F, CA, CF, CK, CMD, or CM. Next is one or no spaces. Then 1 or 2 digits, followed by one or no spaces. Last are one or more non white-space characters.

Note that the pattern is matched on an entire row of 5250 characters, not just on a single output field. Unlike pui["function key pattern"], this pattern should not use the "^" and "$" meta-characters.



Example 2:

The Example 1 pattern could match text incorrectly. For example, the text "OFF1:1" would not be function key, but the pattern would match. To avoid matching F, CA, CF, etc. that are on word endings, this pattern would work:

pui["function key pattern2"] = "( F| CA| CF| CK| CMD| CM|^F|^CA|^CF|^CK|^CMD|^CM) ?([0-9]{1,2}) ?([=:-]) ?(\\S+)";

The pattern detects function key labels starting after a blank or starting at the beginning of a row–beginning with F, CA, CF, CK, CMD, or CM. Next is one or no spaces. Then 1 or 2 digits, followed by one or no spaces. Last are one or more non white-space characters.



Where do you save this configuration option?  Here.

pui["function key pattern2"] is available with Profound UI Version 5, Fix Pack 4.0.



Alternate Syntax
pui["function key pattern2"] = /(F|CA|CF|CK|CMD|CM) ?([0-9]{1,2}) ?([=:-]) ?(\S+)/ig;

The alternate syntax is available after Profound UI V6 FP2.0. It permits you to set the pattern to a RegExp object, allowing you to avoid confusion escaping certain characters, such as the backslash (\).