GET-CLIPBOARD-DATA Action

This document covers the following topics:


Description

Retrieves data in the specified Natural data format from the Windows or drag-drop clipboard. If a drag-drop operation is in progress, the data is preferentially read from the drag-drop clipboard (the local clipboard belonging to the source process), otherwise the data is read from the Windows clipboard.

Both pre-defined and private data formats may be used (see the SET-CLIPBOARD-DATA action). As for the SET-CLIPBOARD-DATA action, multiple data operands may be supplied, which can be any mixture of scalar and or array operands (including array index ranges) of potentially mixed types. In general, each data operand receives one data item (i.e., one text line in the case of the CF-TEXT format or one file name for the CF-FILELIST format) from the clipboard, and the delimiters and trailer (if any) corresponding to the pre-defined formats are skipped. However, if the last operand supplied is a dynamic alpha variable, all remaining unread data items are returned into the variable, including any embedded delimiters (carriage return/line feeds or null-terminators).

The incoming data is automatically converted to the format of the receiving operand in manner compatible with the MOVE statement if the data is not already in this format.

You can use the nX notation to skip one or more data items (see example below).

If more receiving fields are available than the number of items available on the clipboard plus the number of items skipped (if any), the remaining data fields are reset in a manner compatible with the RESET statement (see example below).

Parameters

Name/Data Type Explanation
Format (A253) Input

Clipboard Natural data format. Can be standard numerc string for predefined formats (e.g., CF-TEXT) or user-defined string for private formats.

Data

(List of any type except handles)

Input

Data fields to receive the data. Can consist of any number of non-handle scalar and / or array operands, including array index ranges and multidimensional arrays. Dynamic alpha variables are also supported.

Response (I4) Output

Natural error (if applicable).

Example:

 
DEFINE DATA LOCAL
1 #FMT (A9) CONST<'MYPRIVFMT'>
1 #A (A32)
1 #I (I4) INIT<1880>
1 #D (D)
1 #RESPONSE (I4)
END-DEFINE
*
* The following example demonstrates the use of private formats
*
PROCESS GUI ACTION SET-CLIPBOARD-DATA WITH #FMT
  'A man a plan a canal - Panama' 42 *DATX GIVING #RESPONSE
*
* Read data back in (note use of nX notation to skip second item,
* and that #I is reset as all available data items have been exhausted)
*
PROCESS GUI ACTION GET-CLIPBOARD-DATA WITH #FMT
  #A 1x #D #I GIVING #RESPONSE
*
WRITE 'First item:' #A 'Third item:' #D '=' #I