> For the complete documentation index, see [llms.txt](https://docs.gpmautomate.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gpmautomate.com/automate-zh/action-shi-yong-zhi-nan/clipboard/set-clipboard-text.md).

# Set clipboard text

Set clipboard text 是用于将一段文本字符串或某个变量的值赋值（写入）到操作系统的剪贴板（Clipboard）中的操作。此操作相当于在电脑上选中文字后按下复制快捷键（`Ctrl + C`）的操作。

此操作通常用作在您使用粘贴数据命令之前的过渡步骤，帮助您快速将较长的文本段落或特殊字符输入到浏览器中，而不必担心出现打字错误。

#### 配置参数：

* Text：您想要载入到剪贴板中的原始文本内容（或包含数据的变量）。

> ⚠️ 对于多线程运行（Multi-threading）极其重要的注意事项：与获取文本的操作类似，Set clipboard text 不适合在多线程运行时使用。由于 Windows 操作系统对整个系统仅使用唯一一个共享的 Clipboard，多个 profile 同时向 Clipboard 写入数据会导致争用现象，后面的线程会覆盖前面线程的数据，从而导致结果出错。请优先在单线程运行的场景中使用此操作。

#### 实际示例：自动复制并粘贴长文章内容

当您需要将一段非常长的文本（例如具有复杂换行格式的销售文章）填入网站上的输入框时。如果使用普通的打字操作，系统将花费大量时间逐字输入，并且有时会出现越南语字体乱码的问题。最优的方法是使用 Clipboard：

* 第一步：您调用 Set clipboard text 操作，将文章内容填入 Text 字段中（或传入数据变量 `$postContent`）。
* 第二步：您点击网站上的输入框，然后调用 Key press 操作，使用组合键 `Control+V`，立即将整段文本直接粘贴到网页中。

结果：整篇长文章内容将在一瞬间被粘贴到网站中，确保格式保持不变，不会出现打字错误，并将脚本运行速度提升到最大。

<figure><img src="/files/IYWLF4ikmrvhkmrLjd1w" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.gpmautomate.com/automate-zh/action-shi-yong-zhi-nan/clipboard/set-clipboard-text.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
