> 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/get-clipboard-text.md).

# 获取剪贴板文本

获取剪贴板文本是一个用于读取（获取）计算机剪贴板中存储的所有文本内容的操作——即您刚刚从任何来源执行复制命令 (`Ctrl + C`) 的文本，然后将该值保存到一个输出变量中。

当您需要在外部软件（如 Excel、记事本、其他数据抓取工具）与 GPM 的自动化浏览器之间协调处理数据时，此操作极其灵活。

#### 配置参数：

* 输出变量：保存从剪贴板提取的文本字符串的变量名称。

> ⚠️ 对于多线程（Multi-threading）的极其重要的注意事项：此操作不适合在多线程下运行。Windows 操作系统只有一个共享的剪贴板，供整个计算机使用。如果您同时打开多个配置文件，各线程将会争用并覆盖彼此的数据，导致一个线程错误地获取另一个线程的数据。因此，仅应在单线程（每次一个配置文件）下使用此操作。

#### 实际示例：从外部手动复制的优惠码填入浏览器

假设您正在以单线程模式运行一个自动下单脚本。在您点击运行线程之前，您浏览网页并发现了一个优惠码，您用鼠标选中并按 `Ctrl + C` 将字符串 `GIAMGA50K` 保存到计算机的剪贴板中。

在 GPM Automate 脚本中，当浏览器导航到结账页面并需要输入代码时，您可以按如下配置：

* 步骤 1：调用获取剪贴板文本操作，将输出变量命名为 `$copiedText`。
* 步骤 2：调用输入操作（例如按键），将变量 `$copiedText` 传递到网站上的优惠码输入框中。

结果：系统将自动从 Windows 的剪贴板中提取字符串 `GIAMGA50K` 并直接填入网站以应用优惠码，帮助您顺畅地结合手动操作与自动运行的流程。


---

# 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/get-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.
