Example Code

Programmatically Accessing the Clipboard

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview: This VI gives programmatic access to the clipboard.


Description: The system clipboard is a very useful tool when trying to share information between applications, such as string or numeric data.  The actions that we take when performing copy and paste operations are also programmatically available in LabVIEW, and can be used to share information between a VI and another application in an automated fashion.  The attached example VI demonstrates that through the use of invoke nodes, we have programmatic access to reading and writing to and from the system clipboard.


Requirements: LabVIEW 2012 (or compatible), Hardware: none.


Steps to Implement or Execute Code:

 

1. Run the VI.
2. Press Write Array to write it to the clipboard (the array will be formatted into string).
3. Press Write String to write the value in the "Write String" text box to the clipboard.
4. Pressing Read to read the clipboard, output text will show up in Read String indicator.
5. Clear Clipboard will write an empty string to the clipboard.
6. You could monitor clipboard state in the What's in the Clipboard control.


Additional Information or References:

 

Programmatically Accessing the Clipboard FP.png

 

Programmatically Accessing the Clipboard BD.png


**This document has been updated to meet the current required format for the NI Code Exchange.** 

Chris_G
Sr Test Engineer
Medtronic, Inc.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
alejandroandreatta
Member
Member
on

Cool, thanks. Simple when you see the code but hard to figure out from scratch.

Ata_O_Rahai
Member
Member
on

Thanks for the BRILLIANT TECHNIQUE