$clip = Win32::Clipboard(); sub select_and_paste_into_ppt() { $clip->Empty(); $sheet_to_rename->UsedRange->Select; $sheet_to_rename->UsedRange->Copy; save_image(); paste_image_to_ppt(); $Title->TextFrame->TextRange->{Text} = $sheet_to_rename->{Name} +; $image_count++; add_new_slide(); $clip->Empty(); } sub save_image() { $image = Win32::Clipboard::GetBitmap() or die "\nNo Image Captured + \n"; open BITMAP, ">$path.\\Images\\$image_count.jpg"; binmode BITMAP; print BITMAP $image; close BITMAP; }
Hi Everyone, Above is my perl code to select the cells in excel's active sheet and put the image file in a particular folder. This routine works fine. But if this runs continously for more than 80+ times I get an error "\nNo Image Captured \n" and the program dies(I can remove the die command and let the program continue without any problem but it will skip that particular image). Restarting the computer solves this problem. I have to run this script on the machines that I can not restart. I guess I am opening too many clipboards somehow? Can anyone point me to the right direction?

In reply to Win32::Clipboard dying? by manish.rana@me.com

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.