LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can i make an automatic Print screen in labview ?????

If you use the Write to e.g. PNG it should close automatically, unless you've opened a file ref and is using that. In that case you'll need to close it first.

If you're mailing each picture you should have plenty of time to close the ref. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 41 of 45
(1,481 Views)

I am using the built in 'write-to-png' VI from the image menu. It does not close the file after writing to it. I base this on the following observation: after the file has been written I cannot delete the saved png file if the main VI that calls the 'print-screen/save-png' sub-VI is still running. Windows gives me the message that the file is currently in use by Labview. I interpretted this as meaning that the file is not closed after writing.

 

The main problem I am having is that, the png file seems to not update. That is, the picture stays the same. I have this sub-VI, along with a sub-VI that lets me email the file to myself, in a loop. Each image is the same as the first one taken when I first run the VI. It only seems to change if I stop the VI and re-run. This makes it diffult for me to use the images to remotely monitor the VI progress.

 

This 'print-screen/save-png'  sub-VI simply uses the 'user32.dll' to simulate print-screen, then use 'app: clipboard - get image' to get the image from the clipboard, then I format the picture and use the 'write-to-png.VI' to save it. I've attached it. 

 

It's possible that the problem is with the clipboard; maybe it is not updating? But I think the problem may be that the file never closes and thus isn't written over when the loop calls the sub-VI a second time.

0 Kudos
Message 42 of 45
(1,476 Views)

Do this small modification make any difference?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 43 of 45
(1,465 Views)

@PDC wrote:

 

It's possible that the problem is with the clipboard; maybe it is not updating? But I think the problem may be that the file never closes and thus isn't written over when the loop calls the sub-VI a second time.



So the "file not closing" problem is just speculation.  Do you have any proof that the file is not closing?  Perhaps it is a clipboard problem.  Perhaps it is something else such as the e-mail process.

 

I would break the problem down into smaller parts.  Instead of messing with the clipboard, generate different picture images in a loop and save to a file.  See if you still have a problem.

0 Kudos
Message 44 of 45
(1,452 Views)

It does seem like the clipboard may have something to do with it. I find that, when I run this program in a simple loop containing a sequency that 1st runs the print screen VI and 2nd waits 10s, that I can access and delete the images. However, the 1st image saved is actually the image that should have been saved on the last iteration of the last time I ran this simple loop VI. It also seems to only update the png file if the loop-VI is the top (active) window. 

I've tried a suggestion from another thread (http://forums.ni.com/t5/LabVIEW/take-screenshot-and-saves-the-image-to-a-PNG-file/m-p/2460152/highli... which offered an alternative way to print screen. Here instead you call the Display Workspace proerty node to get the size of the desktop, create a destination bitmap witht he contructor node, Copy from screen using the invoke node, save (as png) and dispose of image also using invoke nodes. I'm not particularly familiar with using nodes in this way, but this VI seems to work more reliably. 

0 Kudos
Message 45 of 45
(1,438 Views)