cypress has asked for the wisdom of the Perl Monks concerning the following question:
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: need program to hang out awhile?
by JavaFan (Canon) on Dec 02, 2009 at 18:49 UTC | |
|
Re: need program to hang out awhile?
by Marshall (Canon) on Dec 03, 2009 at 00:13 UTC | |
|
Re: need program to hang out awhile?
by ww (Archbishop) on Dec 02, 2009 at 20:38 UTC | |
|
Re: need program to hang out awhile?
by tokpela (Chaplain) on Dec 03, 2009 at 10:01 UTC | |
by cypress (Beadle) on Dec 03, 2009 at 14:22 UTC | |
by Jenda (Abbot) on Dec 03, 2009 at 23:33 UTC |