LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access to clipboard in VI scripting

Solved!
Go to solution

The Problem:

Hello all: I'm working on creating an 'insert from clipboard' quick-drop VI based off the default 'insert.vi' from the quickdrop menu.

 

I'm snagged on how LabVIEW holds objects in the clipboard, for example you can copy a primitive (such as index array) and then paste it somewhere else. Outside of LabVIEW clipboard items are just bitmap data (see output from get-clipboard or 'clipboard example.png', both are the same index array primitive)

 

PS C:\Users\nicks> get-clipboard -format image


Tag                  :
PhysicalDimension    : {Width=32, Height=27}
Size                 : {Width=32, Height=27}
Width                : 32
Height               : 27
HorizontalResolution : 96
VerticalResolution   : 96
Flags                : 335888
RawFormat            : [ImageFormat: b96b3caa-0728-11d3-9d7b-0000f81ef32e]
PixelFormat          : Format32bppRgb
Palette              : System.Drawing.Imaging.ColorPalette
FrameDimensionsList  : {7462dc86-6180-4c7e-8e3f-ee7333a7a483}
PropertyIdList       : {}
PropertyItems        : {}

The Question:

Is there a way to access what LabVIEW code is present in my clipboard as a VI scripting action?  Invoke>app>read from clipboard returns an empty string when reading from the same clipboard as above (see clipboard read.png).

 

Failing that, does NI document how LV items are 'rendered' to and then 'decoded' from that bitmap data? All I can find in the NI docs are references to how amazing it is that you can use vi snippets.

________/~~~~~~~~*********~~~~~~~~\________
Certified delinquent LabVIEW developer. Recertifying at next NI Days
Download All
0 Kudos
Message 1 of 6
(2,868 Views)

In addition to the clipboard of the OS, LabVIEW has its own clipboard.

When you copy a LabVIEW object, LabVIEW puts an image on the OS clipboard, and a copy of the object on the internal clipboard.

The is no property/invoke node to access the internal clipboard.

From the menu bar, you can import an image onto the internal clipboard.  It supports alpha channel (i.e. translucent).  Which can be used to customize a ctrl.

 

 

George Zou
0 Kudos
Message 2 of 6
(2,800 Views)

Thank you for your input George, My suspicion that the BMP in the OS-clipboard contained the object data was from looking at the embedded VI data in VI sinppet images.

 

Unfortunately the ability to import images into LabVIEW is unrelated to my goal, which is to paste items from the LabVIEW-clipboard via  VI scripting. 

________/~~~~~~~~*********~~~~~~~~\________
Certified delinquent LabVIEW developer. Recertifying at next NI Days
0 Kudos
Message 3 of 6
(2,790 Views)
Solution
Accepted by topic author szewczak

For your reference, here is a modified version of the Quick Drop Replace shortcut that will replace the selected object with whatever object is on the clipboard:

 

https://forums.ni.com/t5/Quick-Drop-Enthusiasts/Replace-from-Clipboard/gpm-p/3521544

0 Kudos
Message 4 of 6
(2,779 Views)

Awesome I will be messing with this all afternoon thankyou!

________/~~~~~~~~*********~~~~~~~~\________
Certified delinquent LabVIEW developer. Recertifying at next NI Days
0 Kudos
Message 5 of 6
(2,772 Views)

For future reference attached vi snippet is how you access the LabVIEW clipboard (these blue invoke nodes are only available when in VI scripting mode).

________/~~~~~~~~*********~~~~~~~~\________
Certified delinquent LabVIEW developer. Recertifying at next NI Days
0 Kudos
Message 6 of 6
(2,768 Views)