- 发行说明
- 入门指南
- 教程
- 自动化项目
- 创建自动化
- 故障排除
在本教程中,我们将创建一个自动化项目,使您可以轻松地从遵循特定格式的文本块中提取特定数据。假设您在银行工作,并收到许多与新存款交易有关的电子邮件通知。您必须打开每封电子邮件,手动复制金额并将其粘贴到柜员应用程序中,然后将每封处理过的电子邮件移动到 Outlook 文件夹中。电子邮件是自动的,它们都遵循一个模板,并且相同的文本始终显示在电子邮件正文中您需要的金额旁边。例如:
!!!This is an automated message, please do not respond.
A new deposit transaction can be submitted:
Cash in: $10
On Us Check: $20
Not On Us Check: $15
Thank you.
!!!This is an automated message, please do not respond.
A new deposit transaction can be submitted:
Cash in: $10
On Us Check: $20
Not On Us Check: $15
Thank you.
The default Project Notebook contains formulas that can extract only the needed amounts. We will manually edit the Project Notebook to extract the values from one email, as described in Step 2: Set up a project and get the necessary files, and then configure our automation to extract the same values from all similar emails.
自动化将为 Outlook 搜索文件夹中的每个电子邮件执行以下任务,其中包含与存款交易有关的最新未读自动化电子邮件:
- 复制电子邮件的正文,然后将数据粘贴到项目笔记本,在其中使用 Excel 公式提取特定数据以进行文本处理。
- 在桌面应用程序中逐字段输入数据并提交数据。
- 将电子邮件标记为已读,然后将其移至 Outlook 文件夹中作为已处理的电子邮件。
We will create a project and start by adding a Use Desktop Outlook App activity to indicate the Outlook account to use. We will then add a For Each Email activity, and then, to indicate the automation must be executed for each email, we will place all subsequent activities inside For Each Email. We will add a Write Cell activity to copy the body of each email to a specific cell in the Project Notebook. We will then add the UI automation activities needed to enter the data in our desktop application, and finally activities to mark the email as read and move the email.
-
步骤 1:在 Outlook 中创建两个文件夹。
在此示例中,我们将使用主题为
New Deposit Available的电子邮件,正文如前所述。要为从今天起具有指定主题的未读电子邮件创建搜索文件夹,请执行以下操作:
-
打开 Outlook,然后右键单击“文件夹”窗格中的“搜索文件夹”,然后选择“新建搜索文件夹”。
-
在“新建搜索文件夹”窗口中,选择“创建自定义搜索文件夹” > “选择”。
-
在“自定义搜索文件夹”窗口的“名称”框中输入“
Today's deposits”,然后选择“条件”。 -
在“搜索文件夹条件”窗口的“消息”选项卡中:
- 从“时间”旁边的下拉菜单中选择“已接收”和“今天”。
- 在“搜索单词”框中,输入“可用的新存款”。
- 从“里面”下拉菜单中,选择“仅主题字段”。
-
在“更多选择”选项卡中选择“仅项目”,然后从相邻的下拉菜单中选择“未读”。
-
单击“确定”三次以关闭窗口并保存文件夹。
-
在收件箱中创建一个名为“已处理的存款”的文件夹。电子邮件在经处理后将移动到这个文件夹。
-
将几封电子邮件发送到您在自动化中使用的电子邮件帐户,并指定主题和遵循指定模板的正文,但在每封电子邮件中输入不同的金额。
-
发送它们后,确保它们显示在“
Today's deposits”搜索文件夹中。
-
-
步骤 2:设置项目并获取必要的文件。
-
打开项目的“项目笔记本”,然后将电子邮件的正文复制到文本工作表中的单元格 B4,然后在单元格 D5:D7 中三个值中每个值的左侧手动输入文本,在单元格 D5 中输入
Cash in:,在单元格 D6 中输入On Us Check:,在单元格 D7 中输入Not On Us Check:。因为值的右侧没有文本,所以单元格 E5:E7 必须为空。如下图所示,单元格 F5:F7 中已有的公式应提取这些值。保存并关闭项目笔记本。
-
Download and extract the archive with the automation project in this tutorial using the button at the bottom of this page. Double-click the file DoubleUI.exe to open the DoubleUI application.
-
步骤 3:将 Outlook 帐户添加到项目中,并遍历搜索文件夹中的消息。
-
在“活动”面板中,选择“邮件”选项卡,然后双击“使用桌面 Outlook App”。该活动随即添加到“设计器”面板中。
-
在活动中,“帐户”字段中已经选择默认的电子邮件帐户。如果您要使用其他帐户,请从下拉菜单中选择。
在“引用为”字段中,保留默认值
Outlook作为在自动化中引用该帐户时使用的名称。 -
在“活动”面板中,将“遍历电子邮件”活动拖放到“使用桌面 Outlook App”活动中。
-
在“遍历电子邮件”活动中,单击加号
单击“邮件使用来源”字段右侧的 ,然后选择“Outlook” > “[搜索文件夹]” > “[今天的存款]” 。您已经表明要遍历 Outlook 搜索文件夹“今天的存款”中的电子邮件。
-
-
第 4 步:将电子邮件正文复制到项目笔记本中的单元格,以提取文本。
-
在“活动”面板中,选择“Excel”选项卡,然后将“使用 Excel 文件”活动拖放到“遍历文件夹中的文件”活动中。
-
在“Excel 文件”字段下,浏览至“Project_Notebook.xlsx”Excel 文件。
-
在“使用 Excel 文件”活动中,添加“写入单元格”活动。
-
在“写入单元格”活动中:
-
Click Plus
on the right side of the What to write field and then select CurrentMail > Body to indicate that you want to copy the body of the current mail in the iteration. -
Click Plus
on the right side of the Where to write field, and then select Project Notebook (Notes) > Indicate in Excel to open the file in Excel. In the file, select the Text sheet, and then the B4 cell, and click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to paste the email body to cell B4 in the Text sheet of the Project Notebook.
-
-
-
步骤 5:添加桌面应用程序和要在其中执行的活动。
-
在“活动”面板中,选择“App/Web”选项卡,然后将“使用应用程序/浏览器”活动拖放到“写入单元格”活动下方的“遍历电子邮件”活动中。“使用应用程序/浏览器”活动随即添加到“设计器”面板中。
-
在“使用应用程序/浏览器”活动中,单击“指定应用程序”,然后将鼠标指针移至 DoubleUI 应用程序上。该窗口突出显示后,在 DoubleUI 中单击任意位置。
“使用应用程序/浏览器”活动已更新,并且该活动内出现窗口的屏幕截图。
-
在“活动”面板中,选择“App/网页”选项卡,然后将“键入到”活动拖放到“使用应用程序/浏览器”活动中。“键入到”活动随即添加到“使用应用程序/浏览器”活动中。
-
在“键入到”活动中:
-
单击“在屏幕上指定目标”,然后将鼠标指针移到 DoubleUI.exe 应用程序中的“Cash In”字段上,并在该字段突出显示后单击该字段。文本字段将被标识为目标,其旁边的“Cash In”标签被标识为锚点。在“选择选项”窗口中,单击“确认”以保存选择。目标和锚点的图像显示在“键入到”活动中。
您已经表明要在 DoubleUI.exe 应用程序中键入“Cash In”字段。
-
Click Plus
on the right side of the Type this field, and then select Excel > Indicate in Excel. In the Excel file, select the F4 cell (the Cash In value) and click Confirm in the UiPath tab of the Excel ribbon. The Type this field displays your selection as [Excel] Text!F5.您已指明要将“Cash In”值从 Excel 文件复制到 DoubleUI.exe 应用程序中的“Cash In”字段。
-
-
再重复两次步骤 3-4,添加“键入到”活动,以将 Excel 文件中的“银行内求偿支票”和“非银行内求偿支票”值(分别为单元格 F6 和 F7)复制到 DoubleUI 应用程序中的相应字段。
-
在“活动”面板中,选择“App/网页”选项卡,然后将“点击”活动拖放到“使用应用程序/浏览器”活动中“获取文本”活动之后。“点击”活动随即添加到“使用应用程序/浏览器”活动中。
-
在“点击”活动中,单击“在屏幕上指定目标”,然后将鼠标指针移至 DoubleUI.exe 应用程序中的“接受”按钮上,并在该按钮突出显示后,单击该按钮。“接受”按钮将被标识为目标,“取消”按钮被标识为锚点。在“选择选项”窗口中,单击“确认”以保存选择。目标和锚点的图像显示在“点击”活动中。
您已指明要单击 DoubleUI.exe 应用程序中的“接受”按钮。
-
-
步骤 6:将电子邮件标记为已读,然后将其移动到 Outlook 文件夹。
-
在“活动”面板中,选择“邮件”选项卡,然后将“将电子邮件标记为已读/未读”活动拖放到“遍历电子邮件”活动中“使用应用程序/浏览器”活动下方。“将电子邮件标记为已读/未读”活动随即添加到“设计器”面板中。
-
在“将电子邮件标记为已读”活动中:
- Click Plus
on the right side of the Email field and then select CurrentMail to indicate that you want to mark the current mail in the iteration. - From the Mark as drop-down menu, select Read.
- Click Plus
-
在“活动”面板中,将“移动电子邮件”活动拖到“遍历电子邮件”活动中“将电子邮件标记为已读/未读”活动下方。“移动电子邮件”活动随即添加到“设计器”面板中。
-
在“移动电子邮件”活动中:
-
Click Plus
on the right side of the Email field and then select CurrentMail to indicate that you want to move the current mail in the iteration. -
单击字段右侧的“加号”
单击“移至”字段右侧的,然后选择“Outlook” > “[收件箱]” > “[已处理的存款]” 。您已指明要将电子邮件移至“已处理的存款”文件夹。
-
-
在 StudioX 功能区中单击“保存”,以保存自动化,然后单击“运行”来执行此自动化。
对于 Outlook 搜索文件夹中的每封电子邮件,将正文复制到 Excel,提取数据并将其输入到 DoubleUI 桌面应用程序中,然后将该电子邮件标记为已读并移至其他文件夹。
-