954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Win32::Clipboard

Hi all,

There are not too many threads that I start, but I wanted to share with you all something I discovered last week that saved me tons of time. I have a program, which is way to long and complex to post here, that basically opens excel, reads data from MySQL and copies that data into a range in excel and then then program opens MS-Graph and makes a graph with the excel data and copies the MS-Graph graph back onto the page in excel. It does all of this (not the MySQL part) using OLE. And it does this hundreds of times per report - over hundreds of pages with some pages containing multiple graphs. What I discovered is that when Micro$oft released office 2007, the auto-cleaning of the clipboard was not as efficient as it was in office 2003. Occasionally, I would get a dialog box that said "Can't empty clipboard" with an OK button and it would HALT the progress until I hit OK. Major pain in the rear when you're running hundreds of reports containing hundreds of graphs each.

Well, last week I discovered that Active State perl - which is what I use on Windoze - has a module called Win32::Clipboard. Basically, all I had to do to clean up this problem was add:

use Win32::Clipboard;
my $c=Win32::Clipboard(); #that's the "new" method
#do the copy and paste
$c->Empty();


to my code and problem solved. So, if you ever experience this "can't empty clipboard" thing, use Win32::Clipboard to solve it.

See: http://www.xav.com/perl/site/lib/Win32/Clipboard.html

for the other methods.

mitchems
Posting Whiz in Training
295 posts since Feb 2009
Reputation Points: 26
Solved Threads: 38
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: