> 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/cao-zuo-zhi-nan/clipboard/set-clipboard-text.md).

# 设置剪贴板文本

设置剪贴板文本是将一串文本或变量的值赋值（写入）到操作系统的临时存储（剪贴板）中的操作。此操作相当于在计算机上选择文本然后按快捷键复制 (`Ctrl + C`) 的操作。

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

#### 配置参数：

* 文本：您希望加载到临时存储中的原始文本内容（或包含数据的变量）。

> ⚠️ 对于多线程（Multi-threading）的极其重要的注意事项：与获取文本的操作类似，设置剪贴板文本在多线程运行时并不适用。由于Windows操作系统仅使用一个共享剪贴板，多个配置文件同时向剪贴板写入数据会导致争用，后一个线程会覆盖前一个线程的数据，从而导致结果错误。请优先将此操作用于单线程运行的场景。

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

当您需要在网站的输入框中填写一段非常长的文本（例如，格式复杂的销售文章）时。如果使用常规的键入操作，系统将花费大量时间逐个输入字符，并且有时会出现越南语字体错误。最优的方法是使用剪贴板：

* 步骤1：您调用设置剪贴板文本的操作，将文章内容填写到文本框中（或传递数据变量 `$postContent`）。
* 步骤2：您点击网站上的输入框，然后调用按键操作，使用组合键 `Control+V` 立即将整个文本段粘贴到网页上。

结果：整个长文章的内容将在一瞬间粘贴到网站上，确保保持格式，不会出现输入错误，并最大限度地提高脚本的运行速度。


---

# 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/cao-zuo-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.
