LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I copy a string to windows clipboard programmatically?


@Blokk wrote:

@James.M wrote:

By the way, I think rolfk's post is a bit outdated. You can drag the snippet directly from your browser to your block diagram usually without needing to save it to file first.


Nope. Does not work with Firefox in this way, first i have to save the png. However, the simple drag&drop works with Chrome browser... No idea why is this difference.


That's unfortunate. I love the ease of snippets, but having to save them is almost to the level of saving and opening a VI.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 11 of 19
(1,844 Views)

@James.M wrote:

@Blokk wrote:

@James.M wrote:

By the way, I think rolfk's post is a bit outdated. You can drag the snippet directly from your browser to your block diagram usually without needing to save it to file first.


Nope. Does not work with Firefox in this way, first i have to save the png. However, the simple drag&drop works with Chrome browser... No idea why is this difference.


That's unfortunate. I love the ease of snippets, but having to save them is almost to the level of saving and opening a VI.


See the Jing hereag Drag-n-Drop to desktop, Drag-n-Drop to BD:smileyvery-happy:

 

Depending on your OS and Browser, its sort of a safety measure to prevent you from accidentally opening executable code unintentionally.


"Should be" isn't "Is" -Jay
0 Kudos
Message 12 of 19
(1,829 Views)

I think I should switch to Chrome when I use the NI forum (i have everything in Firefox, but anyway...). Specially, since I cannot attach any VI (neither zip) to a post when I use Firefox. Very strange, but inserting a snippet works with Firefox.

Using Chrome, all functionality works.

 

edit: i just tested right now, and I am able to attach even a VI to a post, using Firefox. Very strange! Maybe the attach error is sporadic, and due to the NI server side??

 

edit2: Thanks Jeff! 🙂

0 Kudos
Message 13 of 19
(1,824 Views)

@Wez wrote:

 


@rolfk wrote:

In the meantime since that old thread started about 10 years ago LabVIEW has gotten official support in the VI Server interface.

 

Clipboard String.png

 

This is a snippet! Drag it to your desktop and from there into a LabVIEW diagram. It will work on other platforms than Windows 32 Bit too, unlike the clibboard.llb library.


I had no idea you could drop and drag snippets! I thought snippets were PNG's! Changed my life, now just need to claim back the many dozens of hours I've spent copying snippets by hand........


They ARE png files.  The beauty is that you can still see the code if you don't have LabVIEW, yet it is real code if you do.  You can store metadata with a png file (data not related to the displaying of the picture) and that's where the magic happens.  So don't edit a snippet in a photo editor or you may lose that data and then the magic is gone.  😉

 

As an aside, is this related to scripting in any way?  I can see the drag and drop initiating a scripting sequence that generates the code in your block diagram.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 14 of 19
(1,789 Views)

For those who want it, there's a QDKS which makes the process quicker with browsers which don't drop the snippet, by taking a URL on the diagram and replacing it with the snippet code from that URL - https://decibel.ni.com/content/docs/DOC-6229

 

I don't use it myself and a quick test on FF now shows that when I try to drag the snippet it doesn't allow dropping at all, but I suppose you could right click the image, copy the URL and then paste that into LV, which would still be faster than saving the file and dragging it in.


___________________
Try to take over the world!
0 Kudos
Message 15 of 19
(1,755 Views)

Thank you @Tst for your small LLB. I'm coding in LV 7.1 under contract for a university and your efforts are appreciated. I've called Windows API's before from LV so your code makes perfect sense to me. (I used to develop Windows apps under C++ too.) It's not as portable as a built-in LV call. But one doesn't exist in 7.1 and Windows in the targeted OS. Thanks again!

 

0 Kudos
Message 16 of 19
(1,706 Views)

Well, as the documentation for the VIs says, the code was written by Arnold Bartel, so my effort was limited to keeping and uploading the VIs, but certainly the important thing is to have something that works. Personally, it's been quite a long time since I worked on 7.x on a regular basis, and these days I only use it for supporting certain projects. There are definitely some pain points there where I miss features I got used to from newer versions.


___________________
Try to take over the world!
0 Kudos
Message 17 of 19
(1,689 Views)

@billko wrote:

As an aside, is this related to scripting in any way?  I can see the drag and drop initiating a scripting sequence that generates the code in your block diagram.


Nope this is not scripting, it is just opening the PNG as if it were a VI, because the whole VI is embedded in the PNG file.  PNGs are cool in that you can embed all kinds of meta data in them that aren't displayed in a normal image viewer.  Embedding the whole VI file in the PNG is one of things you can do so when it is dropped on the block diagram the VI is opened, and inlined.

 

Because it hasn't been linked to yet, here is an article talking about them.

 

And here is the Code Capture tool which is a 3rd party add on to LabVIEW that makes snippets so much better than the built in method.

0 Kudos
Message 18 of 19
(1,653 Views)

It works - thank you!

0 Kudos
Message 19 of 19
(542 Views)