Calculator Action Button with Dialog#

Let's consider an example of a robot that shows how to "add" your button to the window of another application and perform a specific action when clicked, in this case - displaying a dialog window with text and a link. Before running the project, the Calculator must be launched (verified with Windows 10).

The robot project consists of a single diagram. Thus, if we describe step by step, this robot works as follows:

  1. Creates a button for the calculator "Show our hint" using the Window Editor.
  2. After clicking the created button, it shows the modal window created in the "Window Editor" with a hint and a link to the calculator in Google Chrome.
  3. After clicking the link, it launches the calculator in Google Chrome, and after clicking the "Close" button, it closes the modal window.

The project diagram looks like this (for convenience, the diagram blocks are numbered):

  1. "Start" Block (any diagram begins with this block).
  2. "Show Button for Calculator" Block allows you to create your own windows (forms) and display them in modal and non-modal mode, including asynchronously relative to the flow of the script. If a selector is specified, the coordinates of the created window will be bound to a control element in another application. To create and edit your window, use the "Edit..." button of the block, and to create reusable windows - the "Window Editor" button on the main toolbar. The following properties are specified for this block:
  • Configuration (configuration string);
  • Window Object (variable with the window object);
  • Selector (identifier of the element to which the window is bound when displayed);
  • Process ID (variable that stores the process identifier, indicates which application to work with);
  • Binding Angle (selection of the binding angle value of the window, when a selector is specified, the binding angle value indicates the binding of the top-left corner of the window to the corner of the found element);
  • X Offset (offset on the X coordinate when displaying the window);
  • Y Offset (offset on the Y coordinate when displaying the window).

The button shown by the block is created using the "Window Editor" tool.

You can view and edit it by clicking the "Edit..." button located inside the block.

  1. "Condition" Block checks the specified condition for truth, after which the script execution continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: "variable" equals (==)/ greater than (>)/ less than (<) "value".

For example: $a == "Hello", that is, if the value of the variable $a is equal to "Hello", then the exit is "Yes", otherwise - the exit is "No".

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is "Yes", otherwise - the exit is "No".

In this case, the condition of clicking the button is used, set as: $ControlEvent != "". That is, if the variable $ControlEvent is not empty, then the exit is "Yes".

  1. "Show Window with Hint and Link" Block allows you to create your own windows (forms) and display them in modal and non-modal mode, including asynchronously relative to the flow of the script. If a selector is specified, the coordinates of the created window will be bound to a control element in another application. To create and edit your window, use the "Edit..." button of the block, and to create reusable windows - the "Window Editor" button on the main toolbar. The following properties are specified for this block:
  • Configuration (configuration string);
  • Window Object (variable with the window object);
  • Modal (when the flag is set, the window will be shown as modal);
  • Process ID (variable that stores the process identifier, indicates which application to work with);
  • Binding Angle (selection of the binding angle value of the window, the value "Default" indicates the center of the element).

The window shown by the block is created using the "Window Editor" tool. You can view and edit it by clicking the "Edit..." button located inside the block.

  1. "Log" Block allows you to output arbitrary messages and/or variable values to the log during the robot's script execution. The property "Value" is specified for this block. A text constant is indicated in quotes, and the variable name starts with the $ symbol. That is, this block writes the value of the variable to the robot's log.
  1. "Condition" Block checks the specified condition for truth, after which the script execution continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: "variable" equals (==)/ greater than (>)/ less than (<) "value".

For example: $a == "Hello", that is, if the value of the variable $a is equal to "Hello", then the exit is "Yes", otherwise - the exit is "No".

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is "Yes", otherwise - the exit is "No".

In this case, the condition of clicking the link is used, set as: $ControlEvent.Contains("LinkLabel"). That is, if the variable contains the text "LinkLabel", then the exit is "Yes".

  1. "Launch Browser" Block launches the selected browser. The following properties are specified for this block:
  • Browser Type (the browser that needs to be opened);
  • URL (the link that should open when launching the browser);
  • Wait Time (the time to wait for the browser to open in seconds).
  1. "Condition" Block checks the specified condition for truth, after which the script execution continues towards the "Yes" exit (if the condition is met) or towards the "No" exit (if the condition is not met).

The condition is written in the format: "variable" equals (==)/ greater than (>)/ less than (<) "value".

For example: $a == "Hello", that is, if the value of the variable $a is equal to "Hello", then the exit is "Yes", otherwise - the exit is "No".

$Result > 5, that is, if the value of the variable $Result is less than 5, then the exit is "Yes", otherwise - the exit is "No".

In this case, the condition of clicking the "Close" button is used, set as: $ControlEvent.Contains("CloseButton"). That is, if the variable contains the text "CloseButton", then the exit is "Yes".