Host Access Beans for Java
After a macro script has been created using the Macro bean, you might want to manually edit it. Manually editing
macro scripts should only be performed by advanced users. This guide to the macro script syntax contains the following
sections:
Contents
Introduction
Macro Syntax
The Most Powerful Macro
Recolimit Demonstration
The IBM Host On-Demand uses XML because a macro is better suited to the state machine model (the main reason
for the move: XML is tailor made for a state machine).
The idea of a state machine may be fairly new to you. The idea behind a state machine, especially in the IBM
Host On-Demand macro context, is simple. Think of how you use a host system from a terminal or a terminal emulator
(like IBM Host On-Demand). The process you follow when you interact with a host system is illustrated in these
steps:
- The host sends an expected screen down to you at your terminal.
- You look at and understand which screen is presented to you.
- You take the required actions based on your understanding (type keystrokes, and so forth).
- Another screen is presented after these actions.
- If you see the screen you expected, you do this all over again.
- If you do not see the screen you expected, call the help desk or handle the error.
This is the idea behind a state machine in the Macro context (although the Macro can't call the help desk for
you). The states are the screens you expect to see, and you take actions on those screens to change from one state,
or screen, to another. That's it, see a screen, perform the action, see the next screen. It is easier to understand
(and program) a macro with this approach than having several if-then-else and do-while programming statements.
Remember, see a screen, perform the action, see the next screen.
Now that you understand that a macro is a series of screens with their actions associated with them, take a
look at how well suited XML is to coding a macro. Here is an example of how to specify a logon macro:
<HAScript>
<screen name="Logon" startscreen="true">
<description>
<string value="Please Logon" casesense="true"/>
<cursor row="12" col="10"/>
</description>
<actions>
<prompt name="ID" row="12" col="10" len="8"/>
<prompt name="Password" row="13" col="10" len="8"/>
<input value="[enter]"/>
</actions>
<nextscreens>
<nextscreen name="Logon.Complete"/>
</nextscreens>
</screen>
</HAScript>
These few lines of code demonstrate the power of this new syntax. All the screens you expect to see for a task
(like logging on) are coded within <screen> elements in XML. You describe the screen in a <description>
element, specify the actions for the screen in an <actions> element, and specify the screen you want to see
next in a <nextscreens> element.
With the above example, keep in mind that the actions fire in sequence. The screen element describes a logon
screen with the text Please Logon on the screen and the screen's cursor position at row 12, column
10. If the Macro logic sees a screen matching this description, it prompts the user for an ID and Password, places
the prompt results at the specified row and column positions, and sends the ENTER key, effectively logging on the user.
The nextscreens element specifies the name of another screen element that appears later in the macro. If the next
screen does not appear, the Macro logic fires an error.
Although there are a large number of valid XML elements, XML is not complicated. A screen is specified with
a description, actions, and the next screens. When a macro is played and a screen matching the description appears,
the actions are executed for that screen and the Macro logic monitors the host for any next screens specified.
The following details each valid macro element:
<HAScript>
<screen>
<comment>
<description>
<oia>
<cursor>
<numfields>
<numinputfields>
<string>
<attrib>
<customreco>
<actions>
<prompt>
<input>
<extract>
<message>
<trace>
<xfer>
<pause>
<mouseclick>
<boxselect>
<commwait>
<custom>
<nextscreens>
<nextscreen>
<recolimit>
The following XML elements and their attributes are valid in the IBM Host On-Demand Macro XML namespace. This
description of the elements is structured like an actual macro file. Note: the element and attribute values are
not case sensitive. Attention: all characters in a macro must be UNICODE characters. Most text editors support
this by default, because they use the ASCII character set, which is at the lower end of the UNICODE character set.
The < HAScript > element is the main enclosing element for the macro. All
other elements at this level that are not HAScript are ignored by the parser.
Attributes:
- name - The name of the macro. This attribute is optional. The name can contain any valid unicode character.
- description - The description of the macro. This attribute is optional. The description can contain
any valid unicode character.
- author - The creator of the macro. This attribute is optional. The author can contain any valid unicode
character.
- creationdate- The date the macro was created. This attribute is optional. The creationdate can contain
any valid unicode character. The date format is not checked.
- promptall - This fires all prompts at the beginning of the macro. This attribute is optional. The default
is true. The value must be true or false.
- pausetime - The sleep time in milliseconds initiated after a screen is matched. This is used to let
the host quiet down. This attribute is optional. The default is no pause. The value must be a number.
Note: The maximum pause time is limited to the platform on which the macro is running.
- timeout - The allowable time in milliseconds between recognition events. If time expires, the macro
goes into the error state. You can override this value in the <nextscreens> element. The default is no timeout.
The value must be a number.
Note: The maximum pause time is limited to largest numeric value supported on
the platform on which the macro is running.
- suppressclearevents - Advanced feature that determines whether the system should ignore screen events
when a host application sends a clear screen command immediately followed by an end of record indicator in the
data stream. You may want to set this value to true if you have screens in your application flow that have all
blanks in them. If there is a valid blank screen in the macro and clear commands are not ignored, it is possible
that a screen event with all blanks will be generated by clear commands coming from an ill-behaved host application.
This will cause a screen recognition event to be processed and the valid blank screen will match when it shouldn't
have matched. This attribute is optional. The default is false. The value must be true or false.
Text Between Elements
- Ignored (elements between elements are not ignored).
Example
<HAScript name="Logon Macro" description="Logs me on"
author="btwebb" creationdate="12/29/1998"
promptall="true" pausetime="500" timeout="10000" > ... </HAScript>
<screen> element - The enclosing element for the screen.
Attributes
- name - The unique identifier for the screen. This attribute is mandatory and must be a unique string
among the other screen IDs. The name can contain any valid unicode character.
- entryscreen - If true, the screen should be the first screen seen. Any other screen generates an error.
This value must be true or false. This attribute is optional. The default is false.
Note: There can be only one screen with the entryscreen attribute set to true.
- exitscreen - If true, a match on the screen causes the macro to stop playing. You can have multiple
screens with the exitscreen attribute set to true. This value must be true or false. This attribute is optional.
The default is false.
- transient - If true, the screen is handled as transient. Transient screens exist outside the normal
macro flow. They are matched after non-transient screens. If you specify next screens in a transient screen,
the next screens are ignored. Use this attribute to specify a "throw away" screen that can appear
at any time in the screen flow. This value must be true or false. This attribute is optional. The default is false.
Text Between Elements
Example
<screen name="screen1" entryscreen="true" exitscreen="false" transient="false">
... </screen>
<comment> element - The comment element for the screen. This can contain
any valid unicode character.
Attributes
Text Between Elements
- Text that is the comment.
Example
<comment> ... </comment>
<description> element - The enclosing element for the description associated
with the screen.
Attributes
Text Between Elements
Example
<description> ... </description>
<numfields> element - The total number of fields on the screen. This element
is optional. The number of fields not used if not specified.
Attributes
- number -The field count. The value must be a number. This is a required element.
- optional - if true, recognition matching passes the element, if they and all other description elements
that are not optional match; or, if there are no non-optional elements, and at least one optional element matches.
The value must be true or false. This element is optional. The default is false.
- invertmatch - if true, recognition matching passes only if the screen does not match this description
element (boolean not operation). The value must be true or false. This element is optional. The default is false.
Text Between Elements
Example
<numfields number="10" optional="false" invertmatch="false" />
<numinputfields> element - The total number of input fields on the
screen. This element is optional. The number of input fields is not used if not specified.
Attributes
- number - The field count. The value must be a number. This is a required element.
- optional - if true, recognition matching passes the element, if they and all other description elements
that are not optional match; or, if there are no non-optional elements, and at least one optional element matches.
The value must be true or false. This element is optional. The default is false.
- invertmatch - if true, recognition matching passes only if the screen does not match this description
element (boolean not operation). The value must be true or false. This attribute is optional. The default is false.
Text Between Elements
Example
<numinputfields number="10" optional="false" invertmatch="false" />
<oia> - specifies an OIA condition to match. This element is optional, default
is to wait for inhibit status.
Attributes
- status - if "NOTINHIBITED", the OIA must be uninhibited for a match to occur. if "DONTCARE",
the OIA inhibit status is ignored. This has the same effect as not specifying OIA at all. Valid values are NOTINHIBITED
and DONTCARE. This is a required element.
- optional -if true, recognition matching passes the element, if they and all other description elements
that are not optional match; or, if there are no non-optional elements, and at least one optional element matches.
The value must be true or false. This element is optional. The default is false.
- invertmatch - if true, recognition matching passes only if the screen does not match this description
element (boolean not operation). The value must be true or false. This attribute is optional. The default is false.
Text Between Elements
Example
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
<string> element - describes the screen based on a string.
Attributes
- value - The string value. This value can contain any valid unicode character. This is a required element.
- row - The starting row position for a string at an absolute position or in a rectangle. The value must
be a number. This value is optional. If not specified, Macro logic searches the entire screen for the string. If
specified, col position is required. <erow> and <ecol> attributes can also be specified to specify
a string in a rectangular area.
Note: Negative values are valid and are used to indicate relative position for the bottom of the screen
(for example, -1 is the last row).
- col - The starting column position for the string at an absolute position or in a rectangle. The value
must be a number. Optional.
- erow - The ending row position for string in a rectangle. The value must be a number. This element is
optional. If both erow and ecol are specified, string is in a rectangle.
- ecol - The ending column position for string in a rectangle. The value must be a number. This element
is optional. If both erow and ecol are specified, string is in a rectangle.
- casesense - if true, string comparison is case sensitive. The value must be true or false. This element
is optional. The default is false.
- optional - if true, recognition matching passes the element, if they and all other description elements
that are not optional match; or, if there are no non-optional elements, and at least one optional element matches.
The value must be true or false. This element is optional. The default is false.
- invertmatch - if true, recognition matching passes only if the screen does not match this description
element (boolean not operation). The value must be true or false. This attribute is optional. The default is false.
Text Between Elements
Example
<string value="hello" row="1" col="1" optional="false" invertmatch="false" />
<string value="hello" row="1" col="1" erow="11" ecol="11"
casesense="false" optional="false" invertmatch="false" />
<string value="hello" />
<cursor> element - describes the screen based on the position of the cursor.
Attributes
- row - The row position of the cursor. The value must be a number. This is a required element.
- col - The column position of the cursor. The value must be a number. This is a required element.
- optional - if true, recognition matching passes the element, if they and all other description elements
that are not optional match; or, if there are no non-optional elements, and at least one optional element matches.
The value must be true or false. This element is optional. The default is false.
- invertmatch - if true, recognition matching passes only if the screen does not match this description
element (boolean not operation). The value must be true or false. This attribute is optional. The default is false.
Text Between Elements
Example
<cursor row="1" col="1" optional="false" invertmatch="false" />
<attrib> element - describes the screen based on an attribute. This is an
advanced feature and should only be used if needed. Usually all the other description elements are enough to describe
a screen.
Attributes
- plane - The plane value string that the attribute resides in. Valid values are COLOR_PLANE, FIELD_PLANE,
and EXFIELD_PLANE. This is a required element.
- value - The hex value string of the attribute. Example, value="0xA0". This is a required element.
- row - The row position of the attribute. The value must be a number. This is a required element.
- col - The column position of the attribute. The value must be a number. This is a required element.
- optional - if true, recognition matching passes the element, if they and all other description elements
that are not optional match; or, if there are no non-optional elements, and at least one optional element matches.
The value must be true or false. This element is optional. The default is false.
- invertmatch - if true, recognition matching passes only if the screen does not match this description
element (boolean not operation). The value must be true or false. This attribute is optional. The default is false.
Text Between Elements
Example
<attrib value="0x01" row="1" col="1" plane="COLOR_PLANE" optional="false"
invertmatch="false" />
<customreco> element - The Macro logic will call out to any custom recognition
listeners for the custom element to have the listener do its own custom screen recognition logic.
Attributes
- ID - The unique identifier for the custom description element. Allows for multiple custom elements.
This can be any valid unicode character. This is a required element.
Text Between Elements
Example
<customreco id="id1" />
<actions> element - The enclosing element for the actions associated with
the screen
Attributes
- promptall - if this value is set to true, the Macro bean will gather all prompts within the current
action element and fire them as one prompt event. The value must be true or false. This attribute is optional.
The default is false.
Text Between Elements
Example
<actions promptall="true"> ... </actions>
<prompt> element - specifies a prompt to be handled for the screen.
Attributes
- row - The row to place the prompt. The value must be a number. This is a required element.
- col - The column to place the prompt. The value must be a number. This is a required element.
- len - The length of the prompt. The value must be a number. This is a required element.
- name - The name of the prompt. This can be any valid unicode character. This element is optional.
- description - The description of the prompt. This can be any valid unicode character. This element
is optional.
- default - The prompt's default value. This can be any valid unicode character. This element is optional.
- clearfield - This clears the host field on placement of prompt text. The value must be true or false.
This element is optional. The default is false.
- encrypted - use a password echo character. The value must be true or false. This element is optional.
The default is false.
- xlatehostkeys - if true, host key mnemonics (example, [enter]) will be translated. For a list of key
mnemonics, see the Host Access Class Library appendix. The value must be true or false. This attribute is optional.
The default is false. If you do not have this value set to true, which is normal because you wouldn't ask users
to type key mnemonics, don't forget to code an input element after the prompt(s) for the current actions to get
the prompt data entered onto the host.
Text Between Elements
Example
<prompt name="ID" row="1" col="1" len="8" description="ID for Logon"
default="btwebb" clearfield="true" encrypted="true" />
<extract> element - specifies an extract to be handled for the screen.
Attributes
- name - The name of the extract. This can be any valid unicode character. This element is optional.
- srow - upper left row of the bounding extract rectangle. The value must be a number. This is a
required element.
- scol - The upper left column of the bounding extract rectangle. The value must be a number. This is
a required element.
- erow - The lower right row of the bounding extract rectangle. The value must be a number. This is a
required element.
- ecol - The lower right column of the bounding extract rectangle. The value must be a number. This is
a required element.
- unwrap - If this value is set to true, the Macro bean will use the underlying screen fields to unwrap
text that is in a field that spans multiple lines on the screen. This will result in an extract String array that
has less elements than the row/col values would indicate. The value must be true or false. The default is false.
Text Between Elements
Example
<extract name="Get Data" srow="1" scol="1" erow="11" ecol="11" />
<input> element - specifies keystrokes to be placed on the screen.
Attributes
- row - The row position to send the keys. The value must be a number. This element is optional. This
defaults to current cursor position.
- col - The column position to send the keys. The value must be a number. This element is optional. This
defaults to current cursor position.
- movecursor - Whether to place the cursor at the end of the input string. The value must be true or false. This
element is optional. This defaults to false.
- value - The text that is sent to the screen. This can be any valid unicode character. This is a required
element.
- xlatehostkeys - if true, host key mnemonics (example, [enter]) will be translated. For a list of key
mnemonics, see the Host Access Class Library appendix. The value must be true or false. This element is optional.
The default is true.
Text Between Elements
Example
<input value="IBM[tab]is cool[enter]" row="1" col="1" movecursor="true"
xlatehostkeys="true" />
<message> element - specifies a message to be sent to the user.
Attributes
- title - The title to display in the message dialog. This can be any valid unicode character. This element
is optional. This defaults to macro name.
- value - The message to display in the dialog. This can be any valid unicode character. This is a required
element.
Text Between Elements
Example
<message value="We are cool" title="Message from IBM" />
<trace> element - specifies a string to be sent to one of several trace facilities.
Attributes
- type - The type can either be sent to IBM Host On-Demand's trace facility, a user trace event, or to
the command line. Respectively, the types are HODTRACE, USER, and SYSOUT. This is a required element.
- value - The text that is sent to trace. This can be any valid unicode character. This is a required
element.
Text Between Elements
Example
<trace value="hello" type="HODTRACE" />
<xfer> element - transfers a file to or from a host system.
Attributes
- direction - The direction for the file transfer. The allowable types are SEND (file from PC to host)
and RECEIVE (file from host to PC). This is a required element.
- pcfile - The PC file name to be used for the file transfer. This should point to a valid file on your
system. This is a required element.
- hostfile - The host file name to be used for the file transfer. This should point to a valid file on
your host system. This is a required element.
- clear - Indicates whether the Macro bean should clear the host screen before performing the file transfer.
The value must be true or false. This element is optional.
- timeout - Sets the time out value (in milliseconds) for the file transfer. If the transfer does not
complete in this given time, the macro will end in error. The value must be a number in milliseconds. This element
is optional and the default is 10000 milliseconds or 10 seconds.
- options - Sets the host specific options for the file transfer. Options are different for every type
of host system. See the File transfer bean documentation or contact your host system administrator for valid options
for your host system. This value must be a unicode string. This element is optional and default is no options.
- pccodepage - Sets the PC code page to use in the file transfer. The value must be a valid PC code page.
See the IBM Host On-Demand online help for session configuration for valid code page values. This element is optional.
- hostorientation - Sets the host character orientation to use in the file transfer. This applies to BIDI
(bidirectional) environments only. See the IBM Host On-Demand online help for session configuration for valid values.
This element is optional and defaults to no value.
- pcorientation - Sets the PC character orientation to use in the file transfer. This applies to BIDI
(bidirectional) environments only. See the IBM Host On-Demand online help for session configuration for valid values.
This element is optional and defaults to no value.
- pcfiletype - Sets the PC file type to use in the file transfer. This applies to BIDI (bidirectional)
environments only. See the IBM Host On-Demand online help for session configuration for valid values. This element
is optional and defaults to no value.
- lamalefexpansion - Sets whether Lam Alef expansion will be used in the file transfer. This applies to
BIDI (bidirectional) environments only. See the IBM Host On-Demand online help for session configuration for page
values. This element is optional and defaults to no value.
- lamalefcompression - Sets whether Lam Alef compression will be used in the file transfer. This applies
to BIDI (bidirectional) environments only. See the IBM Host On-Demand online help for session configuration for
page values. This element is optional and defaults to no value.
Text Between Elements
Example
<xfer direction="send" pcfile="c:\myfile.txt" hostfile="myfile text A0" />
<pause> element - causes the Macro bean to sleep for the given amount of milliseconds.
This action is useful for pausing in between several file transfers.
Attributes
- value - Sets the time to pause (in milliseconds) for the pause action. The value must be a number in
milliseconds. This element is optional and the default is 10000 milliseconds or 10 seconds.
Text Between Elements
Example
<pause value="2000" />
<mouseclick> element - simulates a user mouse click on the Terminal bean.
This essentially sets the cursor at a given row and column position.
Attributes
- row - The host screen row position for the mouse click. This must be a number within the host screen
coordinate system (example, 24 rows by 80 columns). This is an optional element and the default value is 1.
- col - The host screen column position for the mouse click. This must be a number within the host screen
coordinate system (example, 24 rows by 80 columns). This is an optional element and the default value is 1.
Text Between Elements
Example
<mouseclick row="20" col="16" />
<boxselect> element - used for either marking or unmarking the marking
rectangle on the Terminal bean.
Attributes
- srow - upper left row of the bounding selection rectangle. The value must be a number within the
host screen coordinate system (example, 24 rows by 80 columns). Negative values are allowed and specifiy a virtual
position from the last row up (example, if the Screen has 24 rows, a row value of -2 points to the 22nd row). This
is a required element.
- scol - The upper left column of the bounding selection rectangle. The value must be a number within
the host screen coordinate system. Negative values are allowed and specifiy a virtual position from the last row
up. This is a required element.
- erow - The lower right row of the bounding selection rectangle. The value must be a number within the
host screen coordinate system. Negative values are allowed and specifiy a virtual position from the last row up.
This is a required element.
- ecol - The lower right column of the bounding selection rectangle. The value must be a number within
the host screen coordinate system. Negative values are allowed and specifiy a virtual position from the last row
up. This is a required element.
- type - The type of selection action to perform. The value must be either SELECT or DESELECT. This is
an optional element and the default is SELECT.
Text Between Elements
Example
<boxselect srow="1" scol="1" erow="11" ecol="11" type="SELECT" />
<commwait> element - used for performing a communication status wait during
a macro's execution.
Attributes
- value - The type of communication status to wait for. Valid values are CONNECTION_INIT, CONNECTION_PND_INACTIVE,
CONNECTION_INACTIVE, CONNECTION_PND_ACTIVE, CONNECTION_ACTIVE, CONNECTION_READY, and CONNECTION_DEVICE_NAME_READY.
The meaning of these types is documented in the javadoc for the ECLConnection object in the Host On-Demand Host
Acceess Class Library documentation. The two most used and most meaningful types are CONNECTION_READY and CONNECTION_INACTIVE.
This is a required element.
- timeout - Sets the time out value (in milliseconds) for the communication wait. If the wait does not
complete in this given time, the macro will end in error. The value must be a number in milliseconds. This element
is optional and the default is no time out.
Text Between Elements
Example
<commwait value="CONNECTION_READY" timeout="10000" />
<custom> element - enables the user to have an exit to Java code, see Javadoc
for the MacroActionCustom class.
Attributes
- id - The ID of the callout code that the Macro bean will use. This can be any valid unicode character.
This is a required element.
- args - The argument string that can be passed to the callout. This can be any valid unicode character.
This element is optional.
Text Between Elements
Example
<custom id="custom1" args="IBM means world class computers n'all" />
<nextscreens> element - contains all the valid next screens to be recognized
after the current screen's actions have been executed.
Attributes
- timeout - The allowable time in milliseconds that can elapse between current screen and any next screen
before the Macro bean will go into the error state. This overrides the timeout attribute for the entire macro.
The value must be a number. This element is optional. The default is to use the overall macro timeout.
Text Between Elements
Example
<nextscreens> ... </nextscreens>
<nextscreen> element - screen that forces a next screen. Multiple nextscreen
elements are allowed. If a screen appears that is in the macro but is not a next screen, the macro will go into
an error state. If the next screen refers to a screen element that doesn't exist, the Macro will have a parse error.
Attributes
- name - The name of the <screen> element that is the valid next screen. This can be any valid unicode
character. This is a required element.
Text Between Elements
Example
<nextscreen name="screen1" />
<recolimit> element - advanced use only. Used to enforce a limited amount
of time a screen can be recognized in a row before it goes to the screen indicated in the goto attribute.
This element is useful for screen looping where you know exactly how many times you'll see a given screen in a
row. It also is a safeguard against infinite screen recognition.
Attributes
- value - The allowable number of times to recognize a screen. This must be a number. This is
a required element.
Note: The actions will not be executed the last time the screen is recognized.
- goto - The name of screen to go to when recognition limit has been reached. This can be any valid unicode
character but screen must exist in the macro. This element is optional. If no goto screen is given, the macro terminates.
Text Between Elements
Example
<recolimit value="3" goto="endscreen" />
The Most Powerful Macro
This section gets its name because the following example demonstrates how all of the elements and their attributes
can be used in a macro.
<HAScript
name="Logon Macro"
description="Logs me on"
author="btwebb"
creationdate="12/29/1998"
promptall="false"
pausetime="500"
timeout="10000" >
<screen name="Logon" entryscreen="true">
<comment>
The screen description and actions for this screen
are a little out of control, but they demonstrate
how to use everything. Normally, a screen element
would not be so full. But then, this is the King of Macros!
</comment>
<description>
<oia status="NOTINHIBITED" optional="false"
invertmatch="false" />
<string value="Please Logon" casesensitive="true"/>
<cursor row="12" col="10"/>
<numinputfields number="2" optional="false"
invertmatch="false" />
<numfields number="10" optional="false" invertmatch="false" />
<string value="Welcome" row="1" col="1"
optional="false" invertmatch="false"/>
<string value="Enter ID" row="1" col="1" erow="11"
ecol="11" casesense="false" optional="false"
invertmatch="false" />
<string value="USERID" />
<attrib value="0x01" row="1" col="1"
plane="COLOR_PLANE" optional="false" invertmatch="false" />
<customreco id="logon" />
</description>
<actions promptall="true">
<prompt name="ID" row="11" col="10" len="8"
description="ID for Logon" default="btwebb" clearfield="true"
encrypted="true" />
<prompt name="Password" row="13" col="10" len="8"/>
<extract name="Get Data" srow="1" scol="1" erow="11" ecol="11" />
<message value="We are cool" title="Message from IBM" />
<trace value="logging on" type="HODTRACE" />
<custom id="logon" args="IBM means world class computers n'all" />
<input value="[enter]" movecursor="true" xlatehostkeys="true"/>
</actions>
<nextscreens timeout="20000">
<nextscreen name="Logon.Complete"/>
</nextscreens>
</screen>
<screen name="Logon.Complete" exitscreen="true">
<comment>
This screen just checks to see if we're logged on OK then hits the ENTER key.
Because it is a stop screen we don't have to specify any nextscreens element.
</comment>
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
<string value="Logon Successful, hit ENTER to continue" casesensitive="true"/>
</description>
<actions>
<input value="[enter]"/>
</actions>
</screen>
<screen name="MessageRecevied" transient="true">
<comment>
This screen demonstrates the idea of a transient screen.
Say our host system can send us asynchronous messages
while we're logging on, we just want to clear them.
This screen handles this and is valid anytime a message screen appears.
No nextscreens needed here.
</comment>
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
<string value="Message received, hit CLEAR to continue"/>
</description>
<actions>
<input value="[clear]"/>
<xfer direction="send.txt" pcfile="c:\myfile.txt"
pcfile="myfile text a0" />
<pause value="2000" />
<boxselect srow="2" scol="3" erow="2" ecol="30" />
<mouseclick row="23" col="1" />
<input value="logoff[enter]" />
<commwait value="CONNECTION_READY" timeout="10000" />
<message value="Success" title="Macro Message" />
</actions>
</screen>
</HAScript>
This macro demonstrates how to extract a list that exists on multiple screens using the recolimit and invertmatch
attributes. The behavior of this macro is as follows:
- Assume we get to the ExtractScreen.Main screen (recolimit is 1).
- Data is extracted and PF8 is sent to page down.
- The ExtractScreen.Main is matched again (recolimit is 2), and so on.
- If recolimit becomes 25, meaning that ExtractScreen.Main was recognized 25 times, the actions for ExtractScreen.Main
will not be executed the 25th time. Instead, the actions for ExtractScreen.Complete will be executed. The actions
are not executed for ExtractScreen.Main to keep from extracting twice if the ExtractScreen.Complete screen is reached
before the recolimit is reached.
- If ExtractScreen.Complete is matched before the recolimit reaches 25, then we'll just get all the data in the
system.
<HAScript
name="Extracter Macro"
description="Gets me data from a list"
author="btwebb"
creationdate="12/29/1998"
promptall="false"
pausetime="500"
timeout="10000" >
<screen name="ExtractScreen.Main">
<comment>
We'll assume there would be other screens that log us on
and get us to this point.
This screen is the main extraction screen,
and extracts data only if there is no blank
line at the bottom of the screen indicating
there isn't any more data (ala invertmatch="true").
To be safe we'll apply a recolimit of 25.
This screen does an extract, then pages down with PF8.
</comment>
<description>
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
<string value="Data Screen"/>
<string value=" " row="24" col="1" erow="24" ecol="11" invertmatch="true" />
</description>
<actions promptall="true">
<extract name="Get Data" srow="2" scol="1" erow="24" ecol="80" />
<input value="[pf8]"/>
</actions>
<nextscreens timeout="20000">
<nextscreen name="ExtractScreen.Main"/>
<nextscreen name="ExtractScreen.Complete"/>
</nextscreens>
<recolimit value="25" goto="ExtractScreen.Complete"/>
</screen>
<screen name="ExtractScreen.Complete">
<comment>
This screen is the final extraction screen,
and extracts data and sends an exit command.
Note: It is only different from the main screen in that the blanks must be there.
Assume there would be other screens to take care of logging off.
</comment>
<description>
<oia status="NOTINHIBITED" optional="false"
invertmatch="false" />
<string value="Data Screen"/>
<string value=" " row="24" col="1" erow="24" ecol="11"/>
</description>
<actions promptall="true">
<extract name="Get Data" srow="2" scol="1" erow="24" ecol="80" />
<input value="exit[enter]"/>
</actions>
<nextscreens timeout="20000">
<nextscreen name="ExtractScreen.Complete"/>
</nextscreens>
</screen>
</HAScript>
[ Top of Page | Previous Page
| Next Page | Table of Contents
]