When a definition file has been created its screen and field map definitions can be used to greatly simplify and speed up development. The screen definition provides access to specialised functions with the Flynet Viewer toolset that provide powerful transition handling capabilities, as well as the ability to refer to screens by name. The map definition allows the text from parts of a screen to be accessed and controlled by name.
Refer to the following code for an example of navigation through a host system and screen data retrieval using screen maps.
The code has 3 functions/routines:
•connect
•disconnect
•getAccountSummaryInfo
The connect and disconnect methods are self-explanatory and will not be discussed.
The getAccountSummaryInfo function signs onto the host application and navigates to the Account Summary screen. It then retrieves and displays some of the information from this screen. As the definition file has been defined for the Insure application, the script is able to use the screen and map definitions. Below is the XML format of the screen and map definition for the "Start" screen.
<Screen name="Start">
<Comment>Initial screen displayed</Comment>
<Recognize Type="include" row="1" column="27" Text="M U L T X T E R M"/>
<Recognize Type="include" row="10" column="3" Text="SWITCHIT"/>
<FieldMap name="default">
<Field name="Username" row="22" column="23" length="8"/>
<Field name="Password" row="22" column="53" length="8"/>
</FieldMap>
</Screen>
The function begins by getting the screen name by using the getScreenName method. Depending on which screen is currently active, a certain action will be executed.
For example, the first expected screen after the initial connection is the "Start" screen. For this screen it is required to enter the "Username" and to send the ENTER action. Note the use of the mappedSet method which is able to set the value of "Username" without having to know its screen coordinates.
When the navigation has reached the "AcctSummary" screen the function then retrieves information from the screen using the mappedGet method, and generates the following output:
Note that the mappedSet and mappedGet methods are case-sensitive for the name of the field map.