Working with clipboard data (RDP protocol)
Note: This topic applies to RDP Vuser scripts only.
VuGen allows you to copy and paste the text of a clipboard during an RDP session. You can copy the contents locally and paste them remotely, or vice versa—copy the contents from the remote machine and paste them locally. The copying of text is supported in TEXT, LOCALE, and UNICODE formats.
VuGen generates separate functions when copying or saving the clipboard data.

The following example illustrates a copy operation on a local machine and a paste operation on a remote machine:
//Notifies the Remote Desktop that new data is available in the Local machine's
//clipboard.The data can be provided in three formats: TEXT, UNICODE and LOCALE rdp_notify_new_clipboard_data( "StepDescription=Send local clipboard formats 1", "Snapshot=snapshot1.inf", "FormatsList=RDP_CF_TEXT|RDP_CF_UNICODE|RDP_CF_LOCALE", RDP_LAST ); rdp_key( "StepDescription=Key Press 2", "Snapshot=snapshot_9.inf", "KeyValue=V", "KeyModifier=CONTROL_KEY", RDP_LAST ); //Provides clipboard data to the Remote Desktop when it requests the data. rdp_send_clipboard_data( "StepDescription=Set Remote Desktop clipboard 1", "Snapshot=snapshot1.inf", "Timeout=20", REQUEST_RESPONSE, "Format=RDP_CF_UNICODE", "Text=text for clipboard", RDP_LAST);

This example illustrates a copy operation on a remote machine and a paste operation on a local machine:
rdp_key( "StepDescription=Key Press 2", "Snapshot=snapshot_9.inf", "KeyValue=C", "KeyModifier=CONTROL_KEY", RDP_LAST); // The function requests the Remote Desktop UNICODE text and saves it to a //parameter rdp_receive_clipboard_data( "StepDescription=Get Remote Desktop clipboard 1", "Snapshot=snapshot1.inf", "ClipboardDataFormat=RDP_CF_UNICODE", "ParamToSaveData=MyParam", RDP_LAST);
Normally, the Remote Desktop clipboard data is saved in UNICODE format. If the Remote Desktop requests data in the TEXT or LOCALE formats, the rdp_send_clipboard_data function automatically converts the content of MyParam from UNICODE into the requested format and sends it to the Remote Desktop. The Replay log indicates this conversion with an informational message. If the conversion is not possible, the step fails.
For more information about the rdp functions, see the Function Reference.
Correlating clipboard parameters
During a recording session, if the client sends the server the same data that it received, VuGen replaces the sent data with a parameter during code generation. VuGen performs this correlation only when the received and sent data formats are the same.

The following example shows how the same parameter, MyParam, is used for both receiving and sending the data.
// Receive the data from the server rdp_receive_clipboard_data("StepDescription=Get Remote Desktop clipboard 1", "Snapshot=snapshot_9.inf", "Timeout=0", "ClipboardDataFormat=RDP_CF_UNICODETEXT", "ParamToSaveData=MyParam", RDP_LAST); ... // Send the data to the server rdp_send_clipboard_data("StepDescription=Get Remote Desktop clipboard 1", "Snapshot=snapshot_9.inf", "Timeout=10", REQUEST_RESPONSE, "Format=RDP_CF_UNICODETEXT", "Text={MyParam}", RDP_LAST);