? tab(-10, AG_CLIPBOARD); opcode; ","; srow; ","; scol; ","; erow; ","; ecol; ","; rtnflag; ","; text; chr(127);
AG_CLIPBOARD (65) allows for copying text from a variable or screen coordinates to the clipboard, or for retrieving the contents of the clipboard.
See MX_CLIPBOARD for descriptions of the parameters (except rtnflag).
rtnflag should be set to 1 if the operation is to return data or status. In the case of opcodes 0 and 2 (retrieve clipboard contents), the returned data are those contents. In the case of other opcodes, it can return the status code as defined MX_CLIPBOARD.
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 CR, 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.