T-Plan Robot Enterprise 3.4.2 Component Capture
Component Capture allows to
cut image of a component (button, field, text, ...) from the current
desktop image and generate the necessary script code in a simple and
efficient way.
- To activate the Component
Capture mode select the Component Capture button on the tool bar or
the Tools->Component
Capture menu item. The desktop image freezes and turns
gray save for the default capture area. To cancel the capture
mode simply click (deselect) the button or menu item again.
- To
adjust the capture area drag
its corners or dashed side lines. To move the area
perform a mouse drag with
either Ctrl, Alt or Shift pressed. It is recommended to
create the component images as small as possible to improve
performance and increase accuracy.
- The red cross located in the center
of the capture area is called click
point. It can be also dragged and it defines where to
click when the component is found on the screen. The click point
may be even dragged out of the capture area to automate tasks
such as "click XY points in this and this direction from the
component".
- Once you are satisfied with the
capture area and the click point location, select the OK button
to proceed to the Component
Capture window.
- While selecting you may cancel the
current capture area
through clicking on the red cross Cancel button. To recreate the area somewhere
else simply drag your mouse in the image (move mouse while
holding the left mouse button). To cancel the whole action click
the rightmost Exit button.
The Component Capture
window defines the target template image file and the task(s) to be
carried out by the script:
- The first group defines the task to be carried out with the
selected area. It may be saved to a template image
for the Image
Search purposes or used as an area of interest for the OCR or Object
Search. Some actions may have additional parameters which
display dynamically below the drop down. For example, the "Wait until the component displays
and click it" action has a configurable timeout.
- The second group of controls specifies collection, name and target folder
for the component image file. It is not visible if the selected
task is an OCR or object search one. The Image Collection field is
optional and allows to create a new subfolder (collection) for
the component images. The drop down is pre-populated with
folders available in the target one. When the collection is
defined, the image comparison will process all images in the
specified directory (or its subdirectories). To read more about
collections read the Image
Collections chapter of the scripting language
specification.
The Image Name is
mandatory and defines the image file name without extension. The
format and extension is derived from the Extensions drop down
next to the field.
The Target Folder is
by default set to the template directory defined by the
_TEMPLATE_DIR variable in the script. Images and collections
residing under this directory will be called through a relative
path.
For example, the parameters displayed in the picture instruct
the window to create a new image collection (subfolder) called jedit under the C:\MyAutomation\templates
template path and save the component image desktop_icon.png in there.
As the image collection is specified, the script will be
configured to search for all images located in the .
- The third group defines what is to
be done when the task is successfully completed,
that is when the component was found (image search tasks), when
the OCR succeeded to recognize text in the target area and
optionally match it against a pattern, or when at least one
object of the specified color was found in the area. The most
common actions are mouse clicks.
- The fourth group specifies what is
to be done when the component
is not found on the screen. Similar to the previous
control group there's a drop down with a predefined set of
actions. The action selected in the picture will make the script
finish with an exit code of 1.
- The fifth group defines what to do
when multiple instances of the
component are found on the screen. The list of
supported actions is similar to those available in the previous
group. The action selected in the picture will call a custom
Warning command which will create a warning note in the script
report.
- The last group deals with the component location change.
As the original coordinates of the component are saved in the image file meta data,
the script allows to test whether the component has moved and
associate it with an action. The one selected in the picture
will ignore any location changes.
- To close the window, save the
component (template) image and insert the corresponding script
code into the active editor select the OK button.
To go back to the previous desktop view with the capture area
click Back.
To cancel the window, discard any changes and switch off
the Component Capture
mode select Cancel.
To open this help topic select Help.
For example, when closed with OK the window above inserts into the
active editor:
WaitFor match template="jedit"
method=search2 timeout=20s
if ({_EXIT_CODE} > 0) {
Exit
1
} else if ("{_SEARCH_MATCH_COUNT}" > 1) {
Warning
"The JEdit icon
was found {_SEARCH_MATCH_COUNT} times!"
} else {
Mouse
click to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y}
}