- 入门指南
- 设置和配置
- 自动化项目
- 依赖项
- 工作流类型
- 控制流程
- 文件比较
- 自动化最佳实践
- 源代码控件集成
- 调试
- 日志记录
- 诊断工具
- 工作流分析器
- 变量
- 参数
- 导入的命名空间
- 编码自动化
- 基于触发器的 Attended 自动化
- 对象存储库
- ScreenScrapeJavaSupport 工具
- 扩展程序
- Studio 测试
- 故障排除
Studio 用户指南
以下教程将引导您完成在 Studio 中创建库,发布库并在其他自动化项目中使用库的步骤。
创建库与创建基本流程类似。 区别在于,库是一个包含可重用组件的包,这些组件可以在其他项目的上下文中使用。
本示例从 Excel 电子表格获取数据,并将所获数据附加到另一个 Excel 文件。接下来,您还将了解如下步骤:打包、将项目发布到自定义订阅源、将此包安装到其他项目以及使用包中包含的活动。
此示例使用不需要在您的计算机上安装 Microsoft Excel 的 Excel 活动。
我们开始吧。
创建库
-
Launch Studio. In the HOME Backstage view, select Library to create a new library project. The New Blank Library window is displayed.
-
在“新建空白库”窗口中:
-
为新项目输入名称和描述,以概括您打算如何利用此自动化。对于本示例,您可以使用名称“QuickLibrary”。
备注:项目名称不能超过 128 个字符,描述不能超过 500 个字符。
-
选择“显示高级选项”,然后选择创建项目的位置。
-
选择“Windows”作为“兼容性”选项,并选择“VB”作为“语言”。
-
-
Select Create. The new library is opened in Studio.
结果
The library project is created and opens in Studio, ready for activities to be added.
添加 Excel 活动
- 在“活动”面板中,搜索“Excel 流程作用域”活动,并将其拖放到“设计器”面板。
- 向序列中添加“使用 Excel 文件”活动。大多数与 Excel 相关的活动都需要此活动。
- 在“Excel 文件”字段中,找到要从中获取数据的 Excel 文件。或者,您可以使用
“引用为”字段,用于更改在整个工作流中引用此文件的方式(在本例中Excel1)。 4. 在“使用 Excel 文件”活动中添加第二个“使用 Excel 文件”活动,然后浏览到要复制数据的 Excel 文件。 为第二个文件添加可选引用(在此例中为 Excel2)。5. 添加“复制/粘贴范围”活动。
-
在“来源”字段中,选择加号
按钮以指明第一个 workbook 中工作表的名称。对于此示例,此字段应为Excel1.Sheet("Sheet1")。 -
在“目标”字段中,选择Plus
指明第二个 Workbook 中工作表的名称(在本例中为Excel2.Sheet("Sheet1"))。您的项目应如下图所示。 -
In the ribbon, select Run File or use Ctrl + F6 to execute the workflow. The data gathered from the first Excel spreadsheet is copied to another.
结果
The data from the first Excel spreadsheet is copied to the second. The workflow runs successfully.
打包库
要将此库作为可重用组件添加到其他自动化项目,您需要通过发布项目将其打包为.nupkg文件。
-
在 Studio 中打开库项目。
-
From the ribbon, select the Publish button. The Publish Library window opens.
- 在“包属性”选项卡中,输入包名称。在“发行说明”字段中,添加有关库的一些详细信息。这对于跟踪每个新发布版本中对库所做的更改非常有用。
- 在“发布选项”选项卡中,选择“发布到”>“自定义”,然后在“自定义 URL”字段中添加本地文件夹的路径。例如,可以在桌面上创建
myfeed文件夹。
-
Select Publish. The package is now available in the local folder as a
.nupkgfile.
结果
The library is published as a .nupkg file to your custom feed folder and is ready to be installed in other projects.
安装可重用组件
要在另一个项目中使用包,您首先需要将其添加为项目依赖项。 要开始,请在 Studio 中创建新流程,如“创建基本流程”页面中所述。
在“关于依赖项”页面中阅读有关项目依赖项的更多信息。
添加自定义订阅源
-
In the Studio ribbon, select Manage Packages > Settings. The default and user-defined feeds are displayed.
-
在“用户定义的包来源”容器的“名称”字段中,添加订阅源的名称。在“来源”字段中,添加已将库发布到的文件夹的路径。
-
Select Add. Your new feed is added to the section.
结果
The custom feed is added to Studio. It is now available under All Packages when managing package dependencies.
每当您想在 Studio 中添加或删除用户定义订阅源时,您都需要执行上述步骤。 如需活动订阅源的更多相关信息,请参阅“关于活动包”。
安装包
-
在“管理包”窗口左侧的“所有包”选项卡下,转到先前添加的订阅源。系统随即会显示此订阅源上的可用包列表。
-
搜索包并将其选中。在本示例中,包名称为 QuickLibrary。
-
Select Install, then Save. The package is now installed in your project, and visible in the Project panel, under Dependencies.
结果
The package is installed as a dependency in your project. Its activities are available in the Activities panel.
添加库中的活动
-
在“活动”面板,搜索该包的名称,本示例中为
Quick Library。 -
将活动拖放到“设计器”面板。
-
In the Studio ribbon, select Run File or use Ctrl + F6 to execute the activity.
结果
The library activity runs successfully in the project. The reusable component is ready to use in any project where the package is installed.
可重用组件的优点是能够减少重复。您只需创建一次,即可在其他项目中重复使用这些组件。
如要下载在上述操作中创建的库,请单击下方按钮: