LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Ben_Manthey

Copy any Data Type to Clipboard

Status: New

Currently the Clipboard.Write Method in the  App Invoke node only accepts text as a data type. I think it should accept any data type. So for example, if you wire a array of doubles to it you would than be able to paste that data into a spreadsheet. Or wiring a picture data type would allow you to than paste that picture into a image editing program. 

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub

5 Comments
PaulG.
Active Participant

I have a problem using the term "clipboard" if it does not actually take data types that a clipboard would otherwise accept. Kudos.

PaulG.

LabVIEW versions 5.0 - 2023

“All programmers are optimists”
― Frederick P. Brooks Jr.
X.
Trusted Enthusiast
Trusted Enthusiast

If you want to paste data from the clipboard into a spreadsheet, the data needs to be a string, therefore you need to convert it into a string first, which is easily done in LV with a single function.

As far as pasting an image into the clipboard, you can find a way to do it here using a method associated with the Picture object:

Screen Shot 2016-03-29 at 11.30.56.png

 

It's essentially just a matter of converting your image into a pict object first.

 

The problem with generalizing this to ANY data type is that it doesn't make sense unless this is a Microsoft supported type (or MacOS or whatever system you are using) and the target application also supports it. Try to paste an image in Notepad, for instance...

But more generally, the fact that an object is defined in LV doesn't mean it can be pasted in the Clipboard as is.

Ben_Manthey
Member

X.

    You're correct that for many data types you can convert them to text and make them work. But I would like LabVIEW to do this for me. 

 

    The export image function actually returns an image of the control onto the clipboard and it will have the frame and the label and a bunch other stuff that I then need to manually trim off. 

 

    You are of course correct that some LabVIEW data types don't sensibly 'map' into available clipboard data types, but most do. I would like LabVIEW to work for as many data types as possible.

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub

X.
Trusted Enthusiast
Trusted Enthusiast

What do you mean by "LabVIEW [should] do this for me"?

You would want to "pass" a 2D array of doubles to a "Paste to Clipboard" function and hope that LV gets it right?

Not going to happen, because that does not make any particular sense.

Ben_Manthey
Member

X.

     Yes, that's exactly what I expect. Other programs get it right all the time. I can cut a 2D Array from a Excel file into a word document and it works perfectly. 

     If I wire a 2D Array to the LabVIEW function I expect to be able to then paste that into a Excel file perfectly. You can copy and paste data between lots of different programs and it usually works quite well. The way to make this work well is to put things onto the clipboard correctly. I would like the Clipboard.Write Invoke node to work with any (or  as many as possible) data types and the data to be put on the clipboard so it can then be pasted into as many documents as possible. 

     In other words, I'd like LabVIEW to work like many other Windows programs and smoothly copy and paste data between itself and as many other programs as possible.

—Ben
Prevent your computer from sleeping programmatically!
Use Power Requests
Download from GitHub