Hi,

The following code prints fine for me.

$file = "/Users/me/Desktop/test.txt"; $printer = "HP_DESKJET_930C"; system ("lp -d $printer $file");

When I ask to print an Excel file with the following code, I get a command line message indicating that a print request has been made; however, I get nothing out of the printer.

$file = "/Users/me/Desktop/test.xls"; $printer = "HP_DESKJET_930C"; system ("lp -d $printer $file");

Without opening (running) the Excel application first, but rather merely selecting that test.xls file and then "Print" from Menu seems to require Excel to open first before the file can print. (In fact, on this Mac, a print dialog is opened, too, and I have to click a "Print" button -- as if my first request wasn't good enough. At least under Windows one request is adequate.)

If I drop another line into my code (below), hoping to open Excel and test.xls before printing it, the code exits without a command line indication that a print request has been made. (Presumably, my 'if' statement is returning false.) After exiting, the operating system finally gets around to opening Excel and my file, but -- too late! -- no print command is issued.

$file = "/Users/me/Desktop/test.xls"; $printer = "HP_DESKJET_930C"; if (system ("open $file")) { system ("lp -d $printer $file"); }

How do I get my program to hang out and twittle thumbs till Excel might be ready to accept a print call?

Thanks. --cypress


In reply to need program to hang out awhile? by cypress

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.