Genie Macros Panel
Modernized green-screens web enabled with Genie, Profound Logic’s on-the-fly modernization solution, can also integrate seamlessly into Atrium’s menu and security system. This can be accomplished using Genie macros.
Genie macros are flexible scripts that allow developers to:
- Automatically sign the user into Genie.
- Navigate to a certain System i menu or screen.
- Automate keystrokes, etc.
It is highly common that users of green-screen applications will have to drill-down through 3 or 4 levels of menu panels to get to the options they want. In Atrium, you can create a menu option that will automatically take the steps needed to bring up the application, so users simply click on a menu link or button to launch the application directly.
Using these reusable macros, administrators can change the way users navigate to System i applications, without the need to modify the underlying programs.
The Genie Macros Panel consists of 3 subpanels (see screenshot below):
- Screens Panel (top left panel):
The screens panel is used for screen detection and recognition. You can set up reusable screen definitions, which tell Genie how to recognize certain screens by looking for specific text at specific positions (row, column).
- Macros Panel (bottom left panel):
The macros panel is used for managing macros (i.e adding/deleting macros).
- Center Panel:
The Center Panel is used for managing screens along with their identifiers and macro actions to take when specific screens are detected.
As Genie works in a similar manner to a 5250 display emulator, navigating to a specific command or program requires entry of menu options, commands, etc., into the 5250 session. Genie macros accomplish this by allowing Genie to recognize selected screens, and to automatically input data or simulate key strokes.
When launching Genie through Atrium, the 5250 sign on display is bypassed automatically. The first screen that will appear in the session will be the user's initial menu or program, or any preceding OS screen which may display first -- such as Display Program Messages.
A macro can then look for certain screens in the session and take the desired action.
See here for details on how Genie macros are processed, although note that Atrium provides a GUI front-end for creating the macros and manual coding is not used:
Example - Run Command from Main Menu
In this example, a macro will be created that will allow for running a command at the OS main menu. This example will only work if the OS main menu is the first screen which displays in the session and will need adjustment if this is not the case on your system. The first thing we'd like this macro to do is to bypass the Display Program Messages screen which will display if the user is already signed onto another 5250 session (including other Genie sessions). To do this, we will start by adding a definition for this screen.
In the Screens Panel, Click the “Add” button on the toolbar as shown below. Next you’ll be prompted to type in the screen name in the “Add Screen Dialog”. Type in “Display Program Messages” and click “Add”.
You'll see that the screen has been added to the Screens list on the left side.
Next, you need to add some information to allow Genie to recognize this screen. To do so, click the Center Panel’s “Add” button on the toolbar to show the “Add Screen Identifier” Dialog (shown below). Type in the values shown below and then click “Add”.
The row and column numbers here must be those reported by Genie for the field -- which is not necessarily the position the text begins at on a green screen. Leading and trailing blanks will not affect screen detection.
When finished, the Center Panel should now look like the screenshot below.
This panel can be used to modify screen identification values, or to add more. As many values as necessary can be used to ensure unique screen detection.
Our example macro will look at two additional screens -- the system main menu (from which we'll run a command), and the sign on display (we'll close down the session if it displays). Repeat the above steps to add screen definitions for the main menu and sign on screen. Name them 'Main Menu' and 'Sign On', respectively. Use the following identifying values.
For Sign On:
For Main Menu:
Now, you need to add the macro. Click on the “Add” button on the Macro Panel’s toolbar. You’ll be prompted to enter your macro name in a dialog similar to the one shown before in the “Add Screen” dialog.
Name the macro 'Run Command.' After creating the macro definition, we can add screens to detect, and define the actions to take when the screens are detected.
The actions are defined in a non-technical way and can be easily read in plain English as shown below. Following the actions in the screenshot at a higher level, you can gather that the macro (1) detects the “Display Program Messages” screen and bypasses it by pressing the enter key, (2) detects the main menu and enters the command from variable "Command" at the command line, (3) runs the SIGNOFF command if the main menu appears again, and (4) closes down the session when the sign on display appears.
Now, let’s go through the process of creating the actions specified in the screenshot above when a particular screen is detected.
We’ll need to start by adding the “Display Program Messages” screen. To do so, click the “Add Screen” button on the Actions toolbar.
You will then be presented with a dialog to select any of the screens defined previously. Select the “Display Program Messages” screen from the drop down field and be sure to check the “Detect Once” option. This option takes certain actions only once the screen is detected for the first time. Then a different set of actions can be taken if that same screen is detected another time.
Now that you have added the “Display Program Messages” screen, you need to specify the actions to take once it is detected for the first time.
Click the “Add Action” button on the Actions toolbar. A dialog should pop-up in which a predefined set of actions can be performed. Select the “Press key” option from the “Actions” drop down field, and type "Enter" in the "Action data" field:
Next, use the "Add Screen" button in the Actions toolbar to add the Main Menu screen to the macro. Make sure to use the "Detect Once" option when adding this screen. Click Add Actions and fill out the actions dialog like this:
This type of action will enter a value into the field at the given row and column number. As with screen identifiers, this row and column must match to that reported by Genie for the desired field. The value in "Action data" will be entered into the field.
There are two ways the "Action data" can be interpreted:
- When "Data type" is set to "literal value", the text will be entered into the field exactly as you have typed it into "Action data". The value is the same anytime the macro is used.
- When "Data type" is set to "variable value", the text you enter into "Action data" becomes a variable name. When configuring a navigation item to use this macro, you will be prompted for the variable name. The value entered on the navigation item will be written into the field when the macro is run.
- When "Data type" is set to "current user profile", the current user profile will be entered into the field.
In this case, we'll use a variable value "Command" so that we can reuse this macro to run any command from the main menu.
Add another action for the Main Menu screen to press the Enter key. The macro should now look like this:
Now, click the Add Screen button and select the Main Menu screen again. We will reference the screen again so that we can take a different action if/when the main menu appears again after our initial screen detection.
After adding the second occurrence of Main Menu to the macro, use the Add Actions button to add two new actions.
This time our macro will use "literal value" so that the same command (SIGNOFF in this case) will run each time.
The macro should now look like this:
The first time the Main Menu is detected, our command will be entered. Since the "Detect Once" option was used in the first occurence of Main Menu, that block of actions will only happen once. If/when the Main Menu appears again, the SIGNOFF command will be run.
To finish the macro, add the Sign On screen to the macro, along with an action to close the session, like this:
We'll do this because the sign on display will appear after the SIGNOFF command is run. This way the Atrium tab will close automatically when this happens.
The macro should now look like our original screenshot, and we are ready to use it on a menu item.