订阅

UiPath Studio

UiPath Studio 指南

创建基本库

The following tutorial walks you through the steps of creating a library in Studio, publishing and using it in other automation projects.

Creating a library is similar to Creating a Basic Process. The difference is that a library is a package containing reusable components which can be used in the context of other projects.

本示例从 Excel 电子表格获取数据,并将所获数据附加到另一个 Excel 文件。接下来,您还将了解如下步骤:打包、将项目发布到自定义订阅源、将此包安装到其他项目以及使用包中包含的活动。

This example uses Excel activities that do not require Microsoft Excel to be installed on your machine.

我们开始吧。

创建库

  1. 启动 Studio。在“主页”的后台视图中,单击“库”以新建库项目。系统将显示“新的空白库”窗口。
450450
  1. 在“新建空白库”窗口中:
    • 为新项目输入名称和描述,以概括您打算如何利用此自动化。对于本示例,您可以使用名称“QuickLibrary”
      注意:名称不能超过 128 个字符,描述不能超过 500 个字符。
    • 选择创建项目的位置。
    • Select Windows for the Compatibility option and VB for Language.
  2. 单击“创建”。新库随即会在 Studio 中打开。

添加 Excel 活动

  1. In the Activities panel, search for the Excel Process Scope activity and drop it to the Designer panel.
  2. Add a Use Excel File activity to the sequence. This activity is required for most of the Excel-related activities.
  3. In the Excel file field, browse to the Excel file from which you want to get the data. Optionally, you can use
    the Reference as field to change the way this file is referenced throughout the workflow (Excel1 in this case).
  4. Add a second Use Excel File activity inside the first Use Excel File activity and browse to the Excel file where you want to copy the data. Add an optional reference to this second file (Excel2 in this case).
  5. Add a Copy/Paste Range activity.
  6. In the Source field, select the Plus plus buttonplus button button to indicate the name of the sheet in the first workbook. For this example, the field should read Excel1.Sheet("Sheet1").
  7. In the "Destination" field, select Plus plus buttonplus button to indicate the name of the sheet in the second workbook (Excel2.Sheet("Sheet1") in our case). Your project should look like in the image below.
663663
  1. In the ribbon, click Run File or use Ctrl + F6 to execute the workflow. The data gathered from the first Excel spreadsheet is copied to another.

打包库

To add this library as a reusable component to other automation projects, you need to package it as a .nupkg file by publishing the project.

  1. 在 Studio 中打开库项目。
  2. 在功能区中,单击“发布”按钮。“发布库”窗口随即打开。
    • 在“包属性”选项卡中,输入包名称。在“发行说明”字段中,添加有关库的一些详细信息。这对于跟踪每个新发布版本中对库所做的更改非常有用。
    • 在“发布选项”选项卡中,选择“发布到”>“自定义”,然后在“自定义 URL”字段中添加本地文件夹的路径。例如,可以在桌面上创建 myfeed 文件夹。
  3. 单击“发布”。该包现已在本地文件夹中以 .nupkg 文件的形式提供。
814814

安装可重用组件

To use the package in another project, you first need to add it as a project dependency. To get started, create a new Process in Studio, as explained in the Creating a Basic Process page.

Read more about project dependencies in the About Dependencies page.

添加自定义订阅源

  1. 在 Studio 功能区中,依次单击“管理包”>“设置”。系统随即会显示默认订阅源和用户定义的订阅源。
  2. 在“用户定义的包来源”容器的“名称”字段中,添加订阅源的名称。在“来源”字段中,添加已将库发布到的文件夹的路径。
  3. 单击“添加”。新订阅源随即会添加至该部分。
11251125

You need to follow the above steps whenever you want to add or remove a user-defined feed in Studio. Check out the About Activities Packages to read more information about activities feeds.

安装包

  1. 在“管理包”窗口左侧的“所有包”选项卡下,转到先前添加的订阅源。系统随即会显示此订阅源上的可用包列表。
  2. 搜索包并将其选中。在本示例中,包名称为 QuickLibrary
  3. 单击“安装”,然后单击“保存”。此包现已安装到项目中,并可在“项目”面板的“依赖项”下查看。
11251125

添加库中的活动

  1. 在“活动”面板,搜索该包的名称,本示例中为 Quick Library
  2. 将活动拖放到“设计器”面板。
  3. 在 Studio 功能区中,单击“运行文件”或使用 Ctrl + F6 执行该活动。
327327

You can add other activities like Copy Sheet or Auto Fill Range, but these require Microsoft Excel to be installed on your machine.

可重用组件的优点是能够减少重复。您只需创建一次,即可在其他项目中重复使用这些组件。

如要下载在上述操作中创建的库,请单击下方按钮:

约一个月前更新


创建基本库


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

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