T-Plan Robot Documents > T-Plan Robot Enterprise v2 Tutorial

Component capture

This topic deals with T-Plan Robot Enterprise features and it is not applicable to the now legacy VNCRobot Version 1.3 or 2.0 projects.

Component Capture is a new feature delivered in v2.2. It is intended to make scripting against components on the screen simpler and faster. It allows to define a component right on the desktop and specify actions to be executed in various component states and situations. The tool then saves the component image and generates all the necessary test script code into the active editor.

For example, your task is to search for the calculator icon on the desktop and double click it to open the Calculator application. If the icon is not found, you want to terminate the script. If the icon is found more than once, you want the script to click the very last one. To address these requirements one would have to create a template image of the icon and write a script like:

CompareTo "calculator.png" method=search
if ({_EXIT_CODE} > 0) {
  Exit 1
} else if ("{_SEARCH_MATCH_COUNT}" > 1) {
  Eval i="{_SEARCH_MATCH_COUNT}"
  Mouse click count=2 to=x:{_COMPARETO_CLICK_X_{i}},y:{_COMPARETO_CLICK_Y_{i}}
} else {
  Mouse click count=2 to=x:{_COMPARETO_CLICK_X},y:{_COMPARETO_CLICK_Y}
}

Writing this code snippet manually would require a good knowledge of the scripting language. Even with help of the Command and Snippet Wizards it would take quite long. Component Capture will now let you create it in a minute. Watch the video below and eventually review the Component Capture help topic.

Component Capture demo
Component Capture demo
on Windows XP