My Perl script is doing some preliminary manipulation of data in an Excel spreadsheet and then opens it up for the user to make additions/changes. I want to detect when the user has finished and then proceed with additional processing. My first attempt was the following:
print "When finished editing, close the file.\n"; sleep 3; $excel->{Visible} = 1; while ($excel->ActiveWorkbook) { sleep 10; }
This works only under certain timing-dependent conditions. It works if the user closes the file without making any changes. It also works if changes are made only during the sleep period. However if a cell is being edited when the ActiveWorkbook object is being tested, a message appears which says "The message filter indicated that the application is busy", the test fails, and the while loop is terminated. The same thing happens if one tries to close the file and the ActiveWorkbook object is tested while Excel is waiting for a response to "do you want to save changes?".

Is there a way to test if the "message filter" (whatever that is) is busy? Is there some other way to detect when the user has finished editing and has closed the file?


In reply to Checking when Excel editing is done by esr

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.