订阅

UiPath StudioX

UiPath StudioX 指南

自动化基础知识

关于活动

活动是自动化项目的基本构建块,每一个活动代表 StudioX 可以自动化的一个或多个手动任务。一系列相互关联的相关活动构成一个自动化项目。在考虑对重复性流程执行自动化时,必须首先将该流程分解为您要执行的各个单独的手动步骤,然后在 StudioX 中确定要将每个步骤自动化的活动。

例如,假设您要自动化以下工作流:

  1. 打开电子表格。
  2. 打开业务应用程序
  3. 从电子表格中的单元格复制数据。
  4. 将复制的数据粘贴到业务应用程序的字段中。
  5. 单击应用程序中的按钮以提交数据。

当您在 StudioX 中创建一个项目以使该过程自动化时,您将使用以下活动:

  1. 使用 Excel 文件指定您要使用的电子表格。
  2. 使用应用程序/浏览器指定您要使用的应用程序。
  3. “键入到”,以选择业务应用程序中要在其中复制数据的输入字段以及要从中复制数据的单元格。
  4. 点击指定要单击哪个按钮以在业务应用程序中提交数据。

手动步骤与 StudioX 活动之间并不总是一对一的关系。如上例所示,“键入到”活动涵盖两个手动步骤,因为您可以使用该活动来指定所复制文本的来源和目标。

容器活动

容器活动定义了执行添加到其中的活动所要满足的范围或条件。容器活动可以描述为包含一个或多个子活动的父活动。容器活动的示例包括:

  • Resource activities - Add an application resource to the automation and make that resource available to the activities added inside them.
  • For Each activities - Define a collection of items and repeat the activities added inside them once for each of those items.
  • Repeat number of times - Similar to a For Each, but it repeats the activities added inside it for a specified number of times.
  • If开关检查 App 状态 - 评估条件并通过基于评估结果执行其中添加的特定活动来确定自动化流程。
  • Wait for Download - Detects a file download initiated by the activities added inside it and makes the file available in the automation.

资源活动

根据活动所适用的应用程序将活动分类。在将您在应用程序中执行的任务自动化之前,必须先将所需的应用程序资源添加到自动化中。以下活动可将资源添加到您的自动化中:

  • Use Excel File - Use a specified Excel file. The data in the Excel file is available to all the activities added inside this activity. When you configure child activities, you can select individual cells, ranges, or sheets in the file directly from StudioX.
  • Use Desktop Outlook App, Use Outlook 365, and Use Gmail add a desktop Outlook, Outlook 365, and Gmail account to the automation. The emails in the account are available to all the activities added inside this activity. When you configure child activities, you can select individual folders, messages, or message fields directly from StudioX.
  • Use Word File - Use a specified Word document. Add the activities to perform on the file inside this activity.
  • Use Application/Browser - Use a specified desktop application or web browser page. Add the activities to perform in the application or web browser inside this activity.
  • Use PowerPoint Presentation - Use a specified PowerPoint file. Add the activities to perform on the file inside this activity.

您可以根据自动化需求添加任意数量的资源。对于使用多个应用程序的活动,请在另一个资源中添加资源。例如:

  • 要添加同时使用 Excel 文件中的数据和 Outlook 帐户中的电子邮件的活动,请在“使用桌面 Outlook App”活动中添加“使用 Excel 文件”活动,然后在“使用 Excel 文件”中添加常见活动。
  • 要添加同时使用网页和 Word 文档中数据的活动,请在“使用 Word 文件”活动中添加“使用应用程序/浏览器”活动,然后在“使用应用程序/浏览器”中添加常用活动。

向自动化添加全局资源

使用资源活动将资源添加到自动化中时,该资源仅可用于在资源活动内部添加的活动。要使资源可用于项目中的所有活动,可以通过将项目连接到资源来全局添加资源。全局资源是从“Data Manager”面板中管理,而不是作为活动添加到项目中。这意味着将项目连接到资源还有助于节省“设计器”面板中的空间。

For information on how to connect a project to an Excel workbook, see Connecting a Project to an Excel File.

遍历项目

Iterating refers to repeating one or more activities in your automation project for each individual item in a collection of items. To iterate through items, add one of the available For Each activities in which you define the collection, and then add the activities to repeat inside the For Each. When you configure the activities to repeat, indicate that an activity should use data from each item in the iteration by selecting the current item option from the Plus plus buttonplus button menu.
StudioX comes with the following For Each activities:

  • For Each Excel Row - Repeat one or more activities for each row in an Excel table, range, or sheet.
    The current item option is CurrentRow. For some activities, you must also select which column to use from the current row.
  • For Each Excel Sheet - Repeat one or more activities for each sheet in an Excel file.
    The current item option is CurrentSheet.
  • For Each Email - Repeat one or more activities for each message in an Outlook folder, Gmail label, or in a selection of messages.
    The current item option is CurrentMail. For some activities, you must also select which field to use from the current mail: Subject, Body, Body as HTML, Bcc, Cc, To, From, or Priority.
  • For Each File in Folder - Repeat one or more activities for each file in a folder on your computer.
    The current item option is CurrentFile. You must also select which file property to use from the current file: Size, Name, Full Name (includes full path), Folder, Last modified date, Last accessed date, Created date, IsReadOnly, or Size in KB.

在配置“遍历活动”中添加的活动时,为了更容易识别,您可以使用描述您要迭代访问之项目的名称来重命名当前项目选项。

配置活动使用的数据

Activities can receive data as input and, upon execution, they can generate output data. You configure the data for each activity using the Plus plus buttonplus button menu available on the right side of data fields.

Depending on its purpose, an activity can have no data fields, one, or multiple data fields. The following information describes the options you can find in the Plus plus buttonplus button menu. Because the menu displays options that are relevant in the context of each field, activity, and parent activity, only a subset of the options is available for each field.

输入字段的选项

输入字段使用以下选项定义活动接收的数据:

  • 来自已添加至项目的资源的数据:
    • Excel - Data from the Project Notebook or from an Excel file added to the automation. Select named cells, named ranges, tables, or sheets directly from the Plus plus buttonplus button menu, or select Indicate in Excel to open the workbook in Excel and indicate in it. Selecting Custom Input lets you manually enter sheet names, table names, cell addresses, or range addresses. If the activity is inside an For Each Excel Row activity, you can select the current row in the iteration.
    • Outlook/Gmail/Outlook 365 - 来自为父级邮件资源活动定义的电子邮件帐户的数据。执行项目时,可以使用在 Outlook 桌面应用程序中选择的消息;如果该活动在“遍历电子邮件”活动中,则可以使用迭代中的当前电子邮件。
    • PowerPoint - 来自为父级“使用 PowerPoint 演示文稿”活动定义的 PowerPoint 演示文稿中的数据。您可以选择幻灯片、占位符、幻灯片母版或布局。
    • 文件 - 如果活动位于“遍历文件夹中的文件”活动中,则可以使用迭代中当前文件的属性。
  • Text - Enter text using the built-in text builder. You can click Plus plus buttonplus button inside the Text Builder to add Excel data, mail data, or values you saved for later use to the text.
  • Number - Enter a numeric value or a formula. Formulas support the following operators and symbols: + (addition), - (subtraction), * (multiplication), / (division), ^ (exponent, for example 2^3 for 2 raised to the power of 3), ( ) (to enforce the order of operations).
    You can click Plus plus buttonplus button inside the Numeric Calculation window to add numeric values from the project. For example, select a cell in an Excel file, or a numeric value that you saved for later use.
  • Condition Builder - Add conditional statements that are used to determine what activities to execute based on whether or not the conditions are met. For example, the If activity contains a condition field, and it executes a series of activities if the condition is met and, optionally, another set of activities if the condition is not met.
    You create a conditional statement by selecting two values and comparing them using one of the available operators: greater than, greater than or equal, less than, less than or equal, equal to, not equal to, is empty, is not empty, is true, is false, starts with, ends with, contains, is numeric, is not numeric.
    You can add multiple statements and select if all of the statements or any of the statements must be true for the condition to be met.
  • “使用保存的值” - 使用项目中已保存以备后用的另一个活动的输出作为当前字段的输入。
  • “选择日期/时间” - 从日历中选择日期或时间(小时、分钟)。此选项可用于日期和时间字段。
  • “选择持续时间” - 选择持续时间(小时、分钟和秒)。此选项可用于持续时间字段。
  • “运行时询问” - 在项目执行过程中提示输入值,此选项可用于接受文本、数字、日期/时间或布尔值 (True/False) 值的字段。
  • “从剪贴板粘贴” - 将您在另一个活动中复制到剪贴板的输出值用作当前字段的输入内容。此选项可用于接受文本值或 Excel 范围的字段。
  • “变量” - 选择一个为在 App/Web 活动选取器中使用而创建的变量。
  • Task Arguments - Select a created argument to pass data between StudioX activities and apps.
  • “在高级编辑器中打开” - 输入 VB 表达式。
  • “清除值” - 清除字段中的当前选择。

输出字段的选项

输出字段使用以下选项定义活动生成的数据:

  • Excel - Save output to the Project Notebook or an Excel file defined for a parent Use Excel File activity. Select named cells, named ranges, tables, or sheets directly from the Plus plus buttonplus button menu, or select Indicate in Excel to open the workbook in Excel and indicate in it. Selecting Custom Input lets you manually enter sheet names, table names, cell addresses, or range addresses. If the activity is inside an For Each Excel Row activity, you can select the current row in the iteration.
  • “保存以备后用” - 保存输出以供以后在自动化中使用,并输入一个名称以便在项目中引用时使用,然后可以将保存的值选择为另一个活动中的输入。
  • Copy to clipboard - Save the output to the clipboard. You can then paste the value in an input field in another activity. This option is available for fields that output text, Boolean values (True/False), numbers, or Excel ranges (for example, the Destination field in the Copy Range activity). Boolean and number values are converted to text when copied to the clipboard.
  • “重命名保存的值” - 重命名您保存以备后用的值。
  • “变量” - 选择一个为在 App/Web 活动选取器中使用而创建的变量。
  • Task Arguments - Select a created argument to pass data between StudioX activities and apps.
  • “在高级编辑器中打开” - 输入 VB 表达式。
  • “清除值” - 清除字段中的当前选择。

使用一个活动的输出作为另一个活动的输入

将数据从一项活动传递到另一项活动可能非常有用,即使在尝试实现某些工作流程时也至关重要。StudioX 让您可以保存活动生成的输出,然后在后面将其用作项目中其他活动的输入:

  1. 要保存数据以供其他活动使用,请在配置活动输出数据字段的“加号”plus buttonplus button菜单中选择“保存以备后用”选项,然后输入已保存值的名称。您稍后将使用该名称来标识并选择该值作为另一个活动的输入,因此请确保使用描述所保存值的唯一名称。
  2. 要将已保存的数据稍后用作项目中其他活动的输入,请从配置活动输入数据字段的“加号”plus buttonplus button菜单中选择“使用已保存的值”选项中的值。

在多种情况下,此功能可能会很有用。以下是几个示例:

  • “读取文本文件”活动可读取并输出文本文件的内容,然后可以将其用作“追加文本”活动的输入,以将文本添加到 Word 文件。
  • “文件存在”活动检查文件是否存在,并输出结果(真或假),然后在“If”活动的条件下使用该结果来确定文件已存在时要执行的特定操作。

管理参数

Arguments are used to pass data between activities in a project and can be used to integrate an workflow with other products such as UiPath Apps.

Once configured, you can use arguments in an activity similar to how you would use Save for Later Use.

创建参数

  1. Click the Arguments argument buttonargument button button in the Data Manager panel.
  2. Click +Add to create a new argument.
  3. Click the Plus plus buttonplus button menu next to the argument to set a value.

By default, all new arguments are of String type and have an In direction. You can configure arguments, based on how they are used:

  • Type - Choose the value type you want your argument to store. The following options are available:
    • Boolean - This type has only two possible values: true or false. These arguments enable you to make decisions, and therefore have a better control over your workflow.
    • Int32 - This type is used to store numeric information. Some of its uses are to perform equations, comparisons and pass important data.
    • String - Stores text information. This type of argument can be used to store any text-based information such as employee names, usernames or any other strings.
    • Object - Can be used to store different types of data. You can use this type of argument in situations where you need flexibility for the type of data you store in an argument. Make sure that the data type used in Object arguments is compatible with the activities that use the argument.
    • System.Data.DataTable - This type can store big pieces of information, and act as a database or a simple spreadsheet with rows and columns. Can be useful to migrate specific data from a database to another and extract information from a website and store it locally in a spreadsheet, among other uses.
    • Array of [T] - Enables you to store multiple values of the same type.
    • Browse for Types - Allows you to explore more types that can be relevant to your task.
  • Direction - Select a direction for your argument when used with apps. The following options are available:
    • In – the argument can only be used within the given project.
    • Out - the argument can be used to pass data outside of a given project.
    • In/Out – the arguments can be used both within and outside of a given project.

删除参数

  1. Click the Arguments argument buttonargument button button in the Data Manager panel.
  2. Click the X next to the argument you want to remove.

运行自动化

We recommend running your automations often during the design stage. This enables you to verify that the project works as expected and lets you identify potential errors early.

要运行自动化,请在 StudioX 功能区中单击“运行”,或在键盘上按 F5 键。

您可以通过单击功能区中的“停止”或按键盘上的 F5 来停止执行项目。执行项目后,“设计器”面板顶部显示的消息将通知您运行是否成功。

要仅运行项目的一部分,请右键单击任何活动,然后选择:

  • “运行至该活动”,以执行项目中该活动之前的所有活动。
  • “自该活动运行”,以从该活动开始执行项目中的所有活动。

以画中画模式运行

如果要在项目执行期间使用计算机而不受 Robot 的干扰,则可以以画中画模式运行自动化。这将在另一个在单独的窗口中打开的会话中执行项目,从而使您可以完全控制键盘、鼠标和屏幕。

要在画中画模式中运行自动化,请在 StudioX 功能区中单击“运行”旁边的箭头,然后选择“在 PiP 中运行”。或者,您可以按键盘上的 F6键。Robot 会在新窗口中开始执行项目中的活动。

📘

备注:

Automations that use Microsoft Office resources do not run successfully in picture-in-picture if the resources are already open in the main session. Before you run an automation in picture-in-picture, close any PowerPoint, Excel, or Word file that is accessed by the automation.

约一个月前更新


自动化基础知识


建议的编辑仅限用于 API 参考页面

您只能建议对 Markdown 正文内容进行编辑,而不能建议对 API 规范进行编辑。