
Technical Notes |
|
This technical note describes how to record, edit, and create macros. Sample macros are provided to use with Reflection for the Web 2011.
Reflection for the Web 2011 includes powerful macro recording and editing features that enable you to automate frequently performed tasks. The recorded macros and the macros you create use JavaScript as the automation language, so if you already know JavaScript, the syntax of Reflection macros will be familiar.
Both administrators and end users (with the appropriate permissions to access the Reflection for the Web profiler) can create macros.
The macros that an administrator creates are delivered to all users when they access the terminal session, whereas the macros created by an end user are private to just that user.
To get started with macros, record a host logon macro:
The macro is saved as follows:
If you record the macro while configuring the session in the Administrative WebStation, the macro will be saved to the Reflection server after you save and exit the session.
If you record the macro while running the session as an end user, the macro is saved locally as soon as you click Save in the Save Macro dialog box.
After you create a macro, you can edit it later by following these steps:
The macro opens into the Macro Editor window, where you can modify the JavaScript macro source.
From the Macro Editor window, detailed information about Reflection API functions is available in the product Help. (From the Help menu, click Help Topics, or from the Macro Editor toolbar, click the Help button.)
In addition to recording or editing macros, you can also write macros:
Refer to the Reflection for the Web 2011 product help for detailed information about the macro features available in Reflection and a few samples to help you get started.
Additional macro samples that illustrate other JavaScript language and Reflection features are available from the Attachmate Download Library. See Obtaining Sample Macros.
To use the sample macros:
To run a macro from the editor window, choose the Run All command from the Macro Editor's Run menu. You can also save the macro, and then run it from the Macros dialog box, available from the Macro menu.
Notes:
Some samples are designed for specific types of emulation, while others will work with all emulation types.
Samples that require a specific session type will display an alert message if you try to run the macro in an incompatible type of session.
Some sample macros use features that are available only with Java 6 or newer and will not run correctly with earlier versions of the Java Plug-in. Comments at the top of each macro indicate any special requirements.
When you are ready to try some advanced scripting samples--and are comfortable using Java and JavaScript programming--download the following file from the Attachmate Download Library: RWeb2011macros.zip
Here is a brief description of each sample macro:
Finds a string of text on the terminal display. Java controls are used to present a dialog box that prompts for the text to search for.
Basic macros that show how to use the Reflection screen recognition engine to perform an action when an IBM 3270 or OpenVMS host screen appears. The screen recognition methods illustrated in these macros are the basis for many of the other macros included.
An IBM 3270 logon that uses the Reflection screen recognition engine to automate a logon to a z/VM host.
An OpenVMS logon that uses the Reflection screen recognition engine to automate a logon to an OpenVMS host.
Performs a logon to an SSH host, prompting for the username and password.
Performs an automated sign-on to an IBM System z (3270) host, storing credentials back to the Reflection server. This sample is intended for administrators to assign as the automated sign-on macro when configuring a session in the Administrative WebStation.
Although this sample will work for end-users, it will not save credentials to the Reflection server, and credential prompts will appear each time.
Performs an automated sign-on to an IBM i (5250) host, storing credentials back to the Reflection server. This sample is intended for administrators to assign as the automated sign-on macro when configuring a session in the Administrative WebStation.
Although this sample will work for end-users, it will not save credentials to the Reflection server, and credential prompts will appear each time.
Shows the use of various alert and prompt methods in the Reflection for the Web ECL API.
Shows how to create an ECL screen recognition engine and register screens and notification listeners using JavaScript, in order to navigate a university library catalog (Boston University).
Note: For information about programming with Reflection for the Web 2011, see Technical Note 2570.