Get Control

Verb: getControl

Gets information from a control.

Syntax

getControl --selector(ControlSelectors) [--forcerefresh(Boolean)] --id(String) --name(String) --innertext(String) --tagname(String) --xpath(String) --classname(String) --elementvalue(String) --controltype(Nullable<ControlTypes>) --index(Numeric) --control(Control) [--usetable(Boolean)] [--searchbycolumn(Boolean)] --searchcolumn(String) --searchvalue(String) --returncolumn(String) --row(Numeric) [--timeout(TimeSpan)] (Control)=control (Rectangle)=bounds (Numeric)=handle (String)=class

Inputs

Script Designer Required AcceptedTypes Description
--selector Selector Required ControlSelectors Type of selector used to identify user interface controls. There are the following options:
  • Class and value
  • Class name
  • Id
  • Id and name
  • Inner text and control type
  • Name
  • Name and value
  • Type and index
  • Type and name
  • XPath
  • You can use the IBM RPA Studio's recorder to map the controls and obtain the necessary information from the “Selector” parameter, in addition to inserting commands in the autocomplete script this parameter. The recorder is available in the upper toolbar on the platform.
    --forcerefresh Update screen cache Optional Boolean When enabled, performs a new reading of the screen before executing the command to identify new elements and update the screen cache.
    This identification is necessary for the command to work, in case there are any changes on the screen.
    --id Id Only whenSelector is Id, IdAndName Text Control id from which the information is to be obtained.
    --name Name Only whenSelector is Name, NameAndValue, IdAndName, TypeAndName Text Name of the control from which the information is obtained.
    --innertext Text Only whenSelector is InnerTextAndTag Text Internal text of the control.
    --tagname Element Type Only whenSelector is InnerTextAndTag Text Type of the element from which the control information is obtained.
    --xpath XPath Only whenSelector is XPath Text Xpath that leads to the control from which the information is obtained.
    --classname Class Only whenSelector is ClassAndValue, ClassName Text Control class from which the information is obtained.
    --elementvalue Element Value Only whenSelector is ClassAndValue, NameAndValue Text Value of the element from which the control information is obtained.
    --controltype Type Only whenSelector is TypeAndIndex, TypeAndName ControlTypes Type of control from which information is obtained.
    --index Index Only whenSelector is TypeAndIndex Number The index of the control from which the information is obtained.
    --control Control Only whenSelector is Instance Control Control instance.
    This variable is obtained using the Search Control command.
    --usetable Element in Table Optional Boolean When enabled, it makes it possible to find an element within a table by column or row.
    --searchbycolumn Search by Column Optional Boolean Searches the element in the table by column, instead of row.
    --searchcolumn Column Only whenElement in Table is True Text Name or value of the column to be obtained the element.
    --searchvalue Value Only whenSearch by Column is True Text Value used to find the element in the table.
    --returncolumn Return Column Only whenSearch by Column is True Text Column that contains the control.
    --row Row Only whenSearch by Column is False Number Table row to find the element.
    --timeout Timeout Optional Time Span, Number, Text Maximum time limit to execute the command.
    In case no value is defined for the timeout parameter, the execution uses the context timeout defined by the Set Timeout command. If that command is not used on the script, the default timeout is 5 seconds.

    Outputs

    Script Designer AcceptedTypes Description
    control Control Control Returns the instance of the control.
    bounds Bounds Rectangle Returns the control bounds.
    handle Handle Number Returns the control handle.
    Handle is an identifier for the window.
    class Class Text Returns the class of the control.

    Example

    The command Launch and Attach Window opens and associates a Notepad window with the execution context. The command Get Control gets the control information from this window and, at the end, Log Message records the information obtained in the IBM RPA Studio console.

    defVar --name limits --type Rectangle
    defVar --name windowId --type Numeric
    defVar --name class --type String
    defVar --name window --type Window
    launchWindow --executablepath "notepad.exe" --timeout 00:00:10 window=value
    getControl --selector "XPath" --xpath "/root" class=class windowId=handle limits=bounds
    logMessage --message "Limits: ${limits}\r\nClass: ${class}\r\nHandle: ${windowId}" --type "Info"
    // Opens and associates a Notepad window with the execution context, obtains its control information and registers it in the console.
    

    Remarks

    It is possible to use the IBM RPA Studio's recorder to obtain the following information:

  • "Class Name", used in Class;
  • "Id", used in Id;
  • "Inner Text", used in Text;
  • "Name", used in Name;
  • "Tag Name", used in Element Type;
  • "XPath", used in XPath.
  • See Also

  • Attach Window
  • Cancel Token Source
  • Clear Cache
  • Click
  • Click on Cell
  • Click on Menu
  • Click on Value
  • Close Window
  • Control Screenshot
  • Count Windows
  • Expand Tree
  • Find Internet Explorer Browser
  • Find Window
  • Find Windows
  • Focus
  • Focus Window
  • Get Barcode
  • Get Bounds
  • Get Cell Value
  • Get Image Grid
  • Get Interval
  • Get Options
  • Get Table
  • Get Table Information
  • Get Tree Nodes
  • Get Value
  • Handle Open File Dialog
  • Handle Save File Dialog
  • Launch and Attach Window
  • Launch or Attach Window
  • Map Image Grid
  • Maximize or Minimize Window
  • Offset Value
  • Screenshot Window
  • Search Control
  • Select Row
  • Select Tab
  • Set Execution Throttling
  • Set Grid Value
  • Set Value
  • Toggle Control Cache
  • Update Window
  • Verify If Visible
  • Wait and Close Security Window
  • Wait Busy Window
  • Wait Control
  • Wait for Control to Enable
  • Wait for Window to Appear
  • Wait for Window to Close
  • Watch and Close Window