选择行

从使用 IBM RPA Studio的记录器工具获取的表中选择行。

命令可用性: 本地 IBM RPA SaaS 和 IBM RPA

脚本语法

IBM RPA 的专有脚本语言的语法与其他编程语言类似。 该脚本语法在脚本文件中定义命令的语法。 您可以在 IBM RPA Studio的 脚本 方式下使用此语法。

selectRow --rowindex(Numeric) [--simulatehuman(Boolean)] --selector(ControlSelectors) --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)]

依赖关系

  • 使用 Focus (focus) 或 Focus Window (focusWindow) 命令,并在 单击 (click) 命令之前保持显示比例为 100% ,以正确运行 模拟人员 (simulatehuman) 参数。

输入参数

下表显示了此命令中提供的输入参数的列表。 在表中,您可以看到在 IBM RPA Studio的脚本方式及其 Designer 方式等效标签中工作时的参数名称。

设计器方式标签 脚本方式名称 必需的 接受的变量类型 Description
行索引 rowindex Required Number 要选择的行的索引。
模拟人类 simulatehuman Optional Boolean 打开以模拟人员手势选择用户界面控件上的行。

对于非 Java 应用程序,此参数不会影响命令的行为。
选择器 selector Required ControlSelectors 用于标识用户界面控件的选择器类型。

您可以使用 IBM RPA Studio的记录器来映射控件并获取此参数所需的信息。

请参阅 选择器参数选项
标识 id Required when the Selector parameter is Id, IdAndName Text 控件的唯一标识。

在 SAP GUI 中,使用标识选择器来映射 GridView 控件。 请参阅 映射 GridView 控件 ,以获取有关 GridView 标识选择器工作方式的详细信息。
名称 name Required when the Selector parameter is Name, NameAndValue, IdAndName, TypeAndName Text 控件名称。
文本 innertext Required when the Selector parameter is InnerTextAndTag Text 控件所显示的内部文本。
控件类型 tagname Required when the Selector parameter is InnerTextAndTag Text 控件的标记名称。
XPath xpath Required when the Selector parameter is XPath Text 通过控件树到目标控件的路径。
classname Required when the Selector parameter is ClassAndValue, ClassName Text 用于实例化控件的类的名称。
控件值 elementvalue Required when the Selector parameter is ClassAndValue, NameAndValue Text 通过控件存储的值。
类型 controltype Required when the Selector parameter is TypeAndIndex, TypeAndName ControlTypes 控件的类型。

请参阅 controltype 参数选项
索引 index Required when the Selector parameter is TypeAndIndex Number 控件位置。 索引以零开头,它是同等类型中的第一个控件。
控件 control Required when the Selector parameter is Instance Control 控件实例。

通过搜索控件命令来获取 Control 变量类型。
元素位于表中 usetable Optional Boolean 启用此选项可使您能够按列或行在表中查找元素。
按列搜索 searchbycolumn Optional Boolean 启用以在表的特定列中搜索元素。
searchcolumn Required when the Element in Table parameter is True Text 要在其中搜索元素的列。
searchvalue Required when the Search by Column parameter is True Text 这是用于在表中搜索元素的值。
返回列 returncolumn Required when the Search by Column parameter is True Text 包含控件的列。
row Required when the Search by Column parameter is False Number 用于获取元素的行号。

要关闭此参数,请启用按列搜索参数。
Timeout timeout Optional Time Span, Number, Text 查找控件所需的最长等待时间。 如果为空白,那么缺省超时为 5 秒。

selector 参数选项

下表显示了可用于 selector 输入参数的选项。 该表显示了在脚本方式下工作时的可用选项以及在设计器方式下的等效标签。

设计器方式标签 脚本方式名称 Description
类和值 ClassAndValue 它与控件类名和值匹配。
类名 ClassName 它与用于实例化控件的类名匹配。
标识 Id 它与控件的唯一标识匹配。
标识和名称 IdAndName 它与唯一标识和控件名称匹配。
内部文本和控件类型 InnerTextAndTag 它与控件内部文本及其类型属性匹配。
实例 Instance 它与控件实例匹配。
名称 Name 它与控件名称匹配。
名称和值 NameAndValue 它与控件名称和值匹配。
类型和索引 TypeAndIndex 它与控件类型及其在同等类型控件中的位置索引相匹配。
类型和名称 TypeAndName 它与控件类型和名称匹配。
视觉 Vision 它与标识控件的映射图像匹配。
XPath XPath 它与通过控件树到目标控件的路径匹配。

您可以使用 IBM RPA Studio 的记录器来映射控件和获取以下选择器:

  • 类名
  • 标识
  • 内部文本
  • 链接文本
  • 名称
  • 标记名称
  • XPath

controltype 参数选项

下表显示了可用于 controltype 输入参数的选项。 该表显示了在脚本方式下工作时的可用选项以及在设计器方式下的等效标签。

设计器方式标签 脚本方式名称 Description
按钮 Button 它与应用程序中的“按钮”控件匹配。
复选框 CheckBox 它与应用程序中的“复选框”控件匹配。
子窗口 ChildWindow 它与应用程序中的“子窗口”控件匹配。
组合框 ComboBox 它与应用程序中的“组合框”控件匹配。
常规 Generic 它与应用程序中的“常规”控件匹配。
Image Image 它与应用程序中的“图像”控件匹配。
标签 Label 它与应用程序中的“标签”控件匹配。
列表框 ListBox 它与应用程序中的“列表框”控件匹配。
菜单栏 MenuBar 它与应用程序中的“菜单栏”控件匹配。
菜单项 MenuItem 它与应用程序中的“菜单项”控件匹配。
进度条 ProgressBar 它与应用程序中的“进度条”控件匹配。
单选按钮 RadioButton 它与应用程序中的“单选按钮”控件匹配。
滚动条 ScrollBar 它与应用程序中的“滚动条”控件匹配。
滑块 Slider 它与应用程序中的“滑块”控件匹配。
微调器 Spinner 它与应用程序中的“微调器”控件匹配。
状态栏 StatusBar 它与应用程序中的“状态栏”控件匹配。
选项卡页面 TabPage 它与应用程序中的“选项卡页面”控件匹配。
选项卡面板 TabPanel 它与应用程序中的“选项卡面板”控件匹配。
Table 它与应用程序中的“表”控件匹配。
文本框 TextBox 它与应用程序中的“文本框”控件匹配。
切换按钮 ToggleButton 它与应用程序中的“切换按钮”控件匹配。
树形视图 TreeView 它与应用程序中的“树形视图”控件匹配。
TreeTable TreeTable 它与应用程序中的“树表”控件匹配。
窗口 Window 它与应用程序中的“窗口”控件匹配。

示例

以下示例说明了如何使用 Launch and attach Window 命令。

// Enter the path to an application that has a grid view.
launchWindow --executablepath "Application.exe"
// Use the recorder to get the information used in the command parameters.
selectRow --rowindex 2 --simulatehuman  --selector "IdAndName" --id dgvList --name DataGridView
// After selecting the line, still using the recorder to get the information, double-click.
click --selector "IdAndName" --doubleclick  --controlsimilarity 100 --forcerefresh  --id dgvList --name DataGridView

限制

  • 对于非 Java 应用程序,此参数不会影响命令的行为。