UiPath Documentation
studiox
2024.10
true
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。
UiPath logo, featuring letters U and I in white

StudioX user guide

上次更新日期 2026年4月30日

教程:将自己的公式添加到项目笔记本

The default Project Notebook available with all automation projects comes with a number of formulas that can be easily incorporated in your automations when selected from the docs image menu of activity fields. In this tutorial, we will create a simple currency conversion automation that demonstrates how you can add a formula of your own to the Project Notebook and use it in your project.

我们将首先在“项目笔记本”的 Scratchpad 工作表的单元格 C1 中手动添加一个将美元转换为欧元的公式,然后创建一个执行以下任务的自动化程序:

  1. 通过网页搜索检索美元对欧元的汇率,并将其添加到单元格 A1 中。
  2. 在项目执行期间提示输入美元金额,并将其添加到单元格 B1 中。
  3. 显示一个消息框,其中的欧元等于在单元格 C1 中计算的美元金额。

总结一下,我们将命名自动化中使用的单元格并将项目更新为使用命名的单元格,以此确保我们的自动化系统未来不受项目笔记本任何更改的影响。

  1. 设置项目并更新项目笔记本。

    1. Create a new blank project using the default settings.
    2. Click Notebook in the StudioX ribbon to open the file in Excel.
    3. 在 Excel 文件中,选择“Scratchpad”工作表,然后在单元格 C1=A1*B1 中输入公式。此公式使用在单元格 A1 中添加的汇率将单元格 B1 中添加的美元金额转换为欧元。
    4. 保存并关闭项目笔记本。
    5. This example uses Google Chrome, which requires the UiPath® extension for Chrome to be installed. To install it, go to Home (StudioX Backstage View) > Tools, and then, under UiPath Extensions, click Chrome.
  2. 从网页获取汇率。

    1. Open Google Chrome, navigate to google.com, and search for usd to euro exchange rate.

    2. In StudioX, click 文档图像 in the Designer panel, and then find the Use Application/Browser activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    3. In the Use Application/Browser activity, click Indicate application, then move the mouse to the page with the search results for the exchange rate and, when the browser page is highlighted in blue, click anywhere inside it.

      您已表明要在自动化中使用带搜索结果的页面。

    4. Click 文档图像 inside the Use Application/Browser activity, and then find the Get Text activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    5. 在“获取文本”活动中:

      • 单击“在屏幕上指定目标”,然后将鼠标指针移至网页搜索结果页面顶部的欧元值,当该值突出显示时,单击该值。该值被识别为目标,并以绿色突出显示。在“选择选项”窗口中单击“确认”以保存选择。目标和任何已识别锚点的图像将显示在“获取文本”活动中。

      • Click docs image on the right side of the Save to field, and then select Notebook > Indicate in Excel. In Excel, select cell A1, and then click Confirm in the UiPath tab in the Excel ribbon. You have indicated that you want to paste the exchange rate in cell A1 in the Scratchpad sheet of the Project Notebook.

        文档图像

  3. 提示输入美元金额,并显示等值的欧元。

    1. Click 文档图像 below the Get Text activity, and then find the Write Cell activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    2. 在“写入单元格”活动中:

      • Click 文档图像 on the right side of the What to write field, and then select Ask when run.

      • Click docs image on the right side of the Where to write field, and then select Notebook > Indicate in Excel. In Excel, select cell B1, and then click Confirm in the UiPath tab in the Excel ribbon.

        您已指明要在项目执行期间提示用户输入美元金额,并且要将此值粘贴到“项目笔记本”的 Scratchpad 工作表中的单元格 B1 中。

    3. Click 文档图像 below the Write Text activity, and then find the Message Box activity in the search box at the top of the screen and select it. The activity is added to the Designer panel.

    4. In the Message Box activity, click 文档图像 on the right side of the Message field, and then select Text.

    5. 我们想要显示消息“X 美元等于 Y 欧元”。为此,在文本生成器中:

      • Click 文档图像 on the right side of the text box, and then select Project Notebook (Notes) > Indicate in Excel. In Excel, select cell C1, and then click Confirm in the UiPath tab in the Excel ribbon..

      • 输入文本 USD is the equivalent of

      • Click 文档图像 on the right side of the text box, and then select Project Notebook (Notes) > Indicate in Excel. In Excel, select cell B1, and then click Confirm in the UiPath tab in the Excel ribbon..

      • 输入文本 EUR.

        文本应如下图所示。

        文档图像

    6. 在文本生成器中单击“保存”,然后在 StudioX 功能区中单击“保存”以保存自动化,单击“运行”来执行自动化。

      文档图像

      系统会从 Web 搜索中检索汇率,然后提示用户输入一个值,在 Excel 中将该值从美元转换为欧元,并显示一条带有转换结果的消息。

  4. 通过在项目笔记本中命名单元格来优化自动化。

    现在,您的自动化功能已完全可用,但是您可以通过命名其中使用的单元格并更新引用它们的活动来进一步改进它。命名单元格具有以下优点:

    • When configuring activities, you can select named cells directly from the 文档图像 menu, without having to open the file and indicate in Excel.

    • 通过名称而不是通过引用来标识单元格意味着,如果对 Excel 文件的更改导致单元格移位,不必担心会更新活动以指向正确的单元格。

      要命名单元格并更新项目:

    1. 在 Excel 中打开项目笔记本,并使用公式栏左端的“名称框”在 Scratchpad 工作表中重命名以下单元格:为单元格 A1 输入名称ExchangeRate。为单元格 B1, 输入名称 USDValue。为单元格 C1 输入名称 EURValue
    2. 更新项目中的活动以使用单元格名称:
      • In the Get Text activity, click 文档图像 on the right side of the Save to field, and then select Project Notebook (Notes) > Scratchpad [Sheet] > ExchangeRate.
      • In the Write Cell activity, click 文档图像 on the right side of the Where to write field, and then select Project Notebook (Notes) > Scratchpad [Sheet] > USDValue.
      • In the Message Box activity, click docs image, then select Text and update the two references to cells in Excel:
        • Delete [Excel] Scratchpad!B1, then click 文档图像 on the right side of the text box and select Project Notebook (Notes) > Scratchpad [Sheet] > USDValue.

        • Delete [Excel] Scratchpad!C1, then click 文档图像 on the right side of the text box and select Project Notebook (Notes) > Scratchpad [Sheet] > EURValue.

          更新后的项目应如下图所示。

          文档图像

此页面有帮助吗?

连接

需要帮助? 支持

想要了解详细内容? UiPath Academy

有问题? UiPath 论坛

保持更新