
IBM eNetwork Communications Server for Windows NT
Host Publisher Feature, Version 6.01
[Next|Previous|Contents]
Screen Recognition
This point is so important it deserves its own page.
The WaitForScreen Rule
Screen recognition and data collection
occur whenever a Data Loop or Screen macro
issues a WaitForScreen macro command.
Corollary
Screen recognition and data collection only
occur when a Data Loop or Screen macro
issues a WaitForScreen macro command.
When it might affect you
When recording a macro, a WaitForScreen command is inserted at
the following places:
- The beginning of the macro
- Before any macro command that sends input to the terminal.
Note that "input" is defined as the keystrokes through
an Enter, Clear,
PF key, or other key that sends accumulated
keystrokes to the host. There is not a WaitForScreen command before
every keystroke.
Here are some consequences of these rules and the way
that macros are recorded.
- The screen resulting from the last input sent by a macro is not
typically recognized. There is no WaitForScreen inserted after the
last terminal input in a recorded macro.
In a Data Loop macro, typically the last terminal input is used to
terminate the application, and it isn't necessary to recognize the
next screen. But this can be important in a Screen macro, or if a
Data Loop macro does not terminate the application.
To handle this problem, you can add a
WaitForScreen command to the end of the macro.
- Host Publisher can collect the same data items repeatedly if you
send input to the terminal that does not change the displayed data.
Host Publisher executes another WaitForScreen and recognize the same
screen again.
To handle this problem, you can change some of the WaitForScreen
commands to oia.WaitForInput commands (to delay sending input until
the terminal is ready, without triggering screen recognition), or
choose screen confirmation text that only appears on the screen when
you want to collect data.
- You can use a screen macro to navigate to other screens, and they
can be recognized and data collected from them. Restrictions: (1) the
newly recognized screens cannot use their own screen macros; (2)
recorded screen macros might not have their WaitForScreen in the right
place.
- Screens and errors are not recognized during Connect
or Disconnect macros.
How to handle it
-
Always consider recorded macros to be just a starting point.
Look at the recorded macro with these rules in mind, and
add, move, or remove WaitForScreen commands as necessary.
You can use oia.WaitForInput() in some cases
to delay sending input until the terminal is ready.
-
Plan ahead when recording macros. If the most obvious way
to interact with the host application might have problems,
look for another way of working that might work better.
Or plan to edit the macros.
-
Use compound conditions in WaitForScreen instead of separate commands,
to avoid recognizing the same screen twice. For example, suppose you
want to add a command to wait for a string to appear on the screen.
Rather than inserting the complete sequence
screenDesc.Clear();
screenDesc.AddString("some string on the screen");
ps.WaitForScreen(screenDesc,10000);
look for the WaitForScreen() that is already in the macro
at that point and just add
screenDesc.AddString("some string on the screen");
so that you have
screenDesc.Clear();
screenDesc.AddCursorPos(row,col);
screenDesc.AddString("some string on the screen");
ps.WaitForScreen(screenDesc,10000);
You might want to just change the AddCursorPos() command
to AddString().
-
Choose confirmation text for your screens carefully,
so that similar screens are only recognized when you
want them to be.
-
If you need to move or remove a WaitForScreen command in a macro, or
replace it with oia.WaitForInput, ensure that you move or remove the
entire sequence of commands from screenDesc.Clear() through
WaitForScreen(). The macro recorder typically inserts the
following sequence:
screenDesc.Clear();
screenDesc.AddCursorPos(row,col);
ps.WaitForScreen(screenDesc,10000);
You must move or remove the three lines together.
-
If you need to insert a WaitForScreen command into a macro, the
simplest sequence of commands to add is this:
screenDesc.Clear();
screenDesc.AddString("some string on the screen");
ps.WaitForScreen(screenDesc,10000);
See the Macro language section for
an explanation of these commands.
For more details about macros and screen recognition,
see the
Host Access Algorithm section in the Appendix.
It explains how macros are processed by Host Access,
including data collection, screen recognition, and
execution of screen macros.
[Next|Previous|Contents]
IBM eNetwork Communications Server for Windows NT
Host Publisher Feature, Version 6.01