Share this page

# rdp_send_clipboard_data

Sends the local clipboard data to the Remote Desktop.

Clipboard Functions

int rdp_send_clipboard_data( "StepDescription=<step_description>", "Snapshot=<snapshot>", ["ConnectionID=<connection_identifier>",] ["Timeout=<seconds>",] REQUEST_RESPONSE, "Format= <RDP_CF_TEXT| RDP_CF_UNICODETEXT| RDP_CF_LOCALE>", "Text=<clipboard data>", [REQUEST_RESPONSE...], RDP_LAST );

This function returns LR_PASS (0) on success or LR_FAIL (1) on failure. Note that LR_PASS and LR_FAIL generally indicate whether the function call completed without an exception, and not that the test step succeeded.

All string arguments (char type) can be parameterized using standard parameterization.

Argument | Description
--- | ---
StepDescription | A descriptive, unique name for this step. Use any text.
Snapshot | The name of the snapshot file of the screen state before this step.
ConnectionID | The name of the connection on which this function operates. Do not change the recorded ID. If several connections are open and the ID is not specified, the first connection in the script is used. If only one connection is open, the connection ID is not required.
Timeout | The wait time in seconds. If the timeout is exceeded, the function returns LR_FAIL. If no timeout is passed, the default value is taken from the runtime settings.
Format | The format of the clipboard data. Pass one of: `RDP_CF_TEXT, RDP_CF_UNICODETEXT, or RDP_CF_LOCALE.`
Text | A string in the client computer's locale.
REQUEST_RESPONSE | The delimiter marking the beginning of a Format-Text section. There are one or more REQUEST_RESPONSE sections.
RDP_LAST | The delimiter marking the end of the argument list.

The rdp_send_clipboard_data function sends the contents of the client's clipboard to the server.

Each REQUEST_RESPONSE section contains a format specifier and a corresponding text. When the server requests clipboard data, the text paired with the requested format is sent. If there is no REQUEST_RESPONSE section with the requested format, the text of the first REQUEST_RESPONSE is converted to the requested format and sent to the server. If the conversion cannot be performed, the function fails.

The normal flow of clipboard sharing between the local machine and the remote is:

1. rdp_notify_new_clipboard_data is called to inform the remote that clipboard data exists and to list the formats in which it is available.

2. With the call to rdp_send_clipboard_data, the server requests the clipboard content in one of the formats specified in the preceding rdp_notify_new_clipboard_data step.

3. The local machine send the data that corresponds to the requested format.

If the server requests data in a format not passed in the rdp_notify_new_clipboard_data step the text in the first REQUEST_RESPONSE pair in the rdp_notify_new_clipboard_data step is converted to the requested format and sent to the remote. If the conversion fails or is not possible the function fails.

## Example

In this example, if the server requests data in the CF_TEXT format, the contents of `localClipParam_1` are sent. If the server requests data if format CF_UNICODETEXT, the contents of `localClipParam_2` are sent.

rdp_send_clipboard_data(

"StepDescription=Send Clipboard Data",

"Snapshot=someSnapshot_1.inf",

REQUEST_RESPONSE,

"Format=RDP_CF_TEXT",

"Text={`localClipParam_1`}",

REQUEST_RESPONSE,

"Format=RDP_CF_UNICODETEXT",

"Text={`localClipParam_2`}",

RDP_LAST );

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: