> 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/huong-dan-cac-action/clipboard/get-clipboard-text.md).

# Get clipboard text

Get clipboard text là hành động dùng để đọc (lấy) toàn bộ nội dung văn bản đang được lưu trữ trong bộ nhớ tạm (Clipboard) của máy tính – chính là phần văn bản bạn vừa thực hiện lệnh Copy (`Ctrl + C`) từ một nguồn bất kỳ – rồi lưu giá trị đó vào một biến đầu ra.

Hành động này cực kỳ linh hoạt khi bạn cần phối hợp xử lý dữ liệu giữa các phần mềm bên ngoài (như Excel, Notepad, công cụ quét dữ liệu khác) với trình duyệt Automation của GPM.

#### Tham số cấu hình:

* Output variable: Tên biến lưu chuỗi văn bản lấy ra từ bộ nhớ tạm.

> ⚠️ Lưu ý cực kỳ quan trọng đối với Đa luồng (Multi-threading): Hành động này không phù hợp khi chạy đa luồng. Hệ điều hành Windows chỉ có duy nhất một bộ nhớ tạm (Clipboard) chung cho toàn bộ máy tính. Nếu bạn mở nhiều profile chạy cùng một lúc, các luồng sẽ tranh chấp và ghi đè dữ liệu lên nhau, dẫn đến việc luồng này lấy nhầm dữ liệu của luồng kia. Do đó, chỉ nên sử dụng hành động này khi chạy đơn luồng (1 profile tại một thời điểm).

#### Ví dụ thực tế: Lấy mã giảm giá được copy thủ công bên ngoài để điền vào trình duyệt

Giả sử bạn đang chạy một kịch bản đặt hàng tự động ở chế độ đơn luồng. Trước khi bấm chạy luồng, bạn lướt mạng và thấy một mã giảm giá hời, bạn dùng chuột bôi đen và nhấn `Ctrl + C` chuỗi chữ `GIAMGA50K` để lưu vào bộ nhớ máy tính.

Trong kịch bản GPM Automate, khi trình duyệt điều hướng đến trang thanh toán và cần nhập mã, bạn cấu hình như sau:

* Bước 1: Gọi hành động Get clipboard text, đặt tên biến đầu ra là `$copiedText`.
* Bước 2: Gọi hành động nhập liệu (ví dụ Key press), truyền biến `$copiedText` vào ô nhập mã giảm giá trên trang web.

Kết quả: Hệ thống sẽ tự động bốc chuỗi `GIAMGA50K` từ bộ nhớ tạm của Windows và điền thẳng vào website để áp dụng mã giảm giá, giúp bạn kết hợp mượt mà giữa thao tác tay và luồng chạy tự động.

<figure><img src="/files/C0xnPFOYUNNaJhODouN5" 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/huong-dan-cac-action/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.
