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

工作流活动

上次更新日期 2026年2月28日

自定义输入

UiPath.System.Activities.CustomInput

加载自定义 HTML 表单并将其显示在浏览器窗口中,使您能够收集人类用户的某些数据。然后,可以使用后续活动进一步处理在表单中收集的数据。文件中可以使用的语言不只限于 HTML,其他任何语言都受支持。为了能够在 Studio 中检索数据,HTML 文件必须包含某个 JavaScript 函数,请在此处了解该函数的详细信息。

属性

常见
  • “显示名称”- 活动的显示名称。
输入
  • “URI”- 要加载的 HTML 文件的 URI。该字段仅支持字符串和字符串变量。您可以在该字段中输入文件路径或 URL。
    备注:

    使用 URL 时,必须插入其完整格式,例如:“https://activities.uipath.com/docs/custom-input/”。

其他
  • “私有”- 选中后将不再以“Verbose”级别记录变量和参数的值。
输出
  • “结果”- 此为自定义输入表单中的数据,存储在字符串变量中。该字段仅支持字符串变量。

创建自定义 HTML 文件

备注:

要使活动能够检索键入表单的数据,HTML 脚本必须包含“window.external.setResult([Result])”标签,其中“Result”为要检索的数据。

让我们来举例说明一下,假设有一个 HTML 文件可以检索人类用户的“名字”、“姓氏”和“年龄”。输入表单如下所示:

docs image

此页面所采用的 HTML 代码如下所示:

<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>UiPath KYC Solution</title>
  </head>
  <body>
      
          First Name:<br>
          <input type="text" id="First_Name"><br>
          Last Name:<br>
          <input type="text" id="Last_Name"><br>
          Age:<br>
          <input type="text" id="Age"><br>
          <button onclick="SubmitValues()">Submit</button>
    
  </body>
  </html>
<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>UiPath KYC Solution</title>
  </head>
  <body>
      
          First Name:<br>
          <input type="text" id="First_Name"><br>
          Last Name:<br>
          <input type="text" id="Last_Name"><br>
          Age:<br>
          <input type="text" id="Age"><br>
          <button onclick="SubmitValues()">Submit</button>
    
  </body>
  </html>

此页面不包含用于将收集的数据发送回用户处的必要代码。添加后,文件应如下所示:

<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>UiPath KYC Solution</title>
  </head>
  <body>
      
          First Name:<br>
          <input type="text" id="First_Name"><br>
          Last Name:<br>
          <input type="text" id="Last_Name"><br>
          Age:<br>
          <input type="text" id="Age"><br>
          <button onclick="SubmitValues()">Submit</button>
          <script type="text/javascript">
          function SubmitValues(){
            var First_Name = document.getElementById("First_Name").value;
            var Last_Name = document.getElementById("Last_Name").value;
            var Age = document.getElementById("Age").value;
            window.external.setResult(First_Name + "," + Last_Name + "," + Age);
            return true;
          }
            
          </script>
  </body>
  </html>
<!DOCTYPE html>
<html lang="en">
 <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>UiPath KYC Solution</title>
  </head>
  <body>
      
          First Name:<br>
          <input type="text" id="First_Name"><br>
          Last Name:<br>
          <input type="text" id="Last_Name"><br>
          Age:<br>
          <input type="text" id="Age"><br>
          <button onclick="SubmitValues()">Submit</button>
          <script type="text/javascript">
          function SubmitValues(){
            var First_Name = document.getElementById("First_Name").value;
            var Last_Name = document.getElementById("Last_Name").value;
            var Age = document.getElementById("Age").value;
            window.external.setResult(First_Name + "," + Last_Name + "," + Age);
            return true;
          }
            
          </script>
  </body>
  </html>

“自定义输入”活动使用示例

为举例说明该活动的具体用法,我们构建了一个简单的自动化项目,用于收集人类用户的“名字”、“姓氏”和“年龄”,然后将其显示在消息框中。可在此处下载该项目和相应的HTML页面示例。

  • 属性
  • 创建自定义 HTML 文件
  • “自定义输入”活动使用示例

此页面有帮助吗?

获取您需要的帮助
了解 RPA - 自动化课程
UiPath Community 论坛
Uipath Logo
信任与安全
© 2005-2026 UiPath。保留所有权利。