# AG\_CLIPBOARD > [HTML Version](ag_clipboard.htm) _Reviewed and revised December 2023_ **tab(-10, AG\_CLIPBOARD); opcode, srow, scol, erow, ecol, rtnflag, text; chr(127);** [Tab(-10,x) Syntax Notes](ag_xxx_syntax-notes.htm.md) AG\_CLIPBOARD (65) allows for copying text from a variable or screen coordinates to the clipboard, or for retrieving the contents of the clipboard. This function has both a [subroutine and a print tab implementation](subroutine-print-pairs.htm.md). **Parameters** _rtnflag _ Set to 1 to request a response See [MX\_CLIPBOARD](mx_clipboard.htm.md)[xs](keyword-types.htm.md) for descriptions of the remaining parameters. **Response** If _rtnflag_ is not set to 1, none. Otherwise the response depends on the opcode. For opcodes 1, 3, and 5, the response is: _status_,~ For opcodes 0 and 2, the response (retrieve clipboard contents) is: _status_,~ Note that unlike most other AG\_xxx responses, this one ends with a tilde instead of a carriage return, partly because the clipboard contents may or may not contain carriage returns. Consequently you cannot use a traditional INPUT statement to retrieve the response and must rely on a method which doesn't require a carriage return termination. See Examples. **Examples** Copy some explicit text to the ATE clipboard: \! opcode=3, coordinates=0, rtnflag=0 (no response needed) ? tab(-10,AG\_CLIPBOARD);"3,0,0,0,0,0,some clipboard text";chr(127); Retrieve ATE clipboard contents. Note that return string is formatted as 'status,text~' with no trailing , so we can't use INPUT to retrieve it. Instead we'll input it one character at a time to build up the string, then parse it into the status and text... MAP1 PLINE\$,S,512 MAP1 A,F ? tab(-10,AG\_CLIPBOARD);"2,0,0,0,0,1";chr(127); do A = getkey(-1) if A # 126 PLINE\$ = PLINE\$ + chr(A) loop until A=126 \! terminate on tilde (126) \! now parse it out A = instr(1,PLINE\$,",") if A > 0 then STATUS = PLINE\$\[1,A-1\] : PLINE\$ = PLINE\$\[A+1,-1\] ? "Status: ";STATUS ? "Clipboard contents: ";PLINE\$ Note that the above case could be handled much more simply with a single instance of [MX\_CLIPBOARD](mx_clipboard.htm.md). **Comments** The keyboard command CTRL+SHIFT+ALT+S can also be used to copy the current screen text contents to the clipboard. **See Also** • [MX\_CLIPBOARD](mx_clipboard.htm.md)[xs](keyword-types.htm.md)