- 入门指南
- 教程
- 自动化项目
- 创建自动化
- 故障排除
StudioX 用户指南
在本教程中,我们将创建一个自动化程序,将 Outlook 搜索文件夹中所有电子邮件的附件保存到您的计算机,然后将这些文件移动到计算机上的另一个文件夹,并通过在文件名中添加今天的日期来重命名它们。要重命名文件,我们将使用 StudioX 中可用的默认项目笔记本中的公式。
我们将创建一个项目,并首先添加 “使用 Outlook 桌面 App”活动以指示要使用的 Outlook 帐户。在此活动中,我们将添加遍历电子邮件活动,然后添加常见场景遍历邮件附件,以指明我们要保存每封电子邮件的附件,然后在保存每个文件后对其进行处理。遍历保存附件的文件夹中的每个文件,然后添加一个写入单元格活动,以复制文件名并在项目笔记本中编辑名称,并添加一个移动文件活动,以将具有更新名称的文件移动到另一个文件夹文件夹中。
-
在计算机上创建两个文件夹,并在 Outlook 中创建一个搜索文件夹。
- 在计算机 C 盘的根目录中创建两个文件夹,分别称为“输入”和“输出”。
- 打开 Outlook,然后右键单击“文件夹”窗格中的“搜索文件夹”,然后选择“新建搜索文件夹”。
- 在“新建搜索文件夹”窗口中,选择“创建自定义搜索文件夹” > “选择”。
- 在“自定义搜索文件夹”窗口的“名称”框中输入“上周的附件”,然后选择“条件”。
- 在“搜索文件夹条件”窗口的“消息”选项卡中,从“时间”旁边的下拉菜单中选择“已接收”和“上周”。
- 在“更多选择”选项卡中选择“仅项目”,然后从相邻的下拉菜单中选择一个或多个附件。
- 单击“确定”三次以关闭窗口并保存搜索文件夹。
-
设置项目。
-
将 Outlook 帐户添加到项目中。
-
在“活动”面板中,选择“邮件”选项卡,然后双击“使用桌面 Outlook App”。该活动随即添加到“设计器”面板中。
-
在活动中,“帐户”字段中已经选择默认的电子邮件帐户。如果您要使用其他帐户,请从下拉菜单中选择。
在“引用为”字段中,保留默认值
Outlook作为在自动化中引用该帐户时使用的名称。
-
-
遍历 Outlook 搜索文件夹中的消息。
-
在“活动”面板中,将“遍历电子邮件”活动拖放到“使用桌面 Outlook App”活动中。
-
In the For Each Email activity, click Plus
on the right side of the In emails from field, and then select Outlook > [Search Folders] > [Last week's attachments]. Your selection is displayed in the field as Last week's attachments.您已指明要遍历 Outlook 文件夹“Last week's attachments”中的电子邮件。
-
-
遍历邮件附件。
-
Click Add activity
inside the For Each Email activity and then, in the search box at the top of the screen, select the common scenario Iterate through mail attachments. -
浏览并选择“收件箱”文件夹,然后单击“确定” 。
将两个活动添加到您的项目中:
-
“保存电子邮件附件” ,通过为“电子邮件”字段选择
CurrentMail,这表示应将迭代中当前邮件中的附件保存到“收件箱”文件夹中,该文件夹以“保存到文件夹”字段中所选择的C:\In来指定。 -
“遍历文件夹中的文件”,在“文件夹”字段中选择
C:\In,以指明您将遍历此文件夹中的文件。如果您单击“开始”以立即执行自动化,则邮件附件将下载并保存到“收件箱”文件夹中。
-
-
-
重命名邮件附件并将其移动到其他文件夹。
-
在“活动”面板中,选择“Excel”选项卡,然后将“使用 Excel 文件”活动拖放到“遍历文件夹中的文件”活动中。
-
在“使用 Excel 文件”活动中添加“写入单元格”活动。
-
在“写入单元格”活动中:
- Click Plus
on the right side of the What to write field and then select CurrentFile > Full Name (includes full path) to indicate that we want to copy the full path of the current file in the iteration. - Click Plus
on the right side of the Where to write field and then select Notebook > File [Sheet] > FullFileName [Cell] to indicate that we want to paste the full path of the current file in the iteration to the FullFileName named cell in the File sheet of the Project Notebook.
- Click Plus
-
单击 StudioX 功能区中的“笔记本” 。在 Project_Notebook.xslx 文件中,转到“File”工作表,将已命名单元格
ReformattedFileName(B14) 中的值更新为=FileNameNoExtension & "-" & YYYYMMDD & "." & FileExtension并保存文件。此公式会将当前日期添加到文件名的末尾。 -
在活动面板中,选择“文件”选项卡,然后将“移动文件”活动拖放到“便利文件夹中的文件”内的“写入单元格”活动之后。
-
在“移动文件”活动中:
- Click Plus
on the right side of the From field and then select CurrentFile > Full Name (includes full path) to indicate the full path of the current file in the iteration. - Click Plus
on the right side of the To field and then select Text. In the Text Builder, enter C:\Out\and then click Plus
on the right side of the window and select Notebook > File [Sheet] > ReformattedFileName [Cell]. The path in the Text Builder should look like this: C:\Out\[Notes] File!ReformattedFileName. - Make sure the Overwrite option is selected.
- Click Plus
-
Click Save in the Text Builder.
-
在 StudioX 功能区中单击“保存”,以保存自动化,然后单击“运行”来执行此自动化。
Outlook 搜索文件夹中每封电子邮件的附件都将保存到计算机上的“收件箱”文件夹中,程序会将今天的日期添加到文件名称中,然后将其移到“发件箱”文件夹中。下载示例
-