|
|
Print to Unix systems without direct printer access
Whoa! That's *two* ssh connections, and two unqualified `rm's. Lets try this:
You'll notice that at the end of the ssh line, "$3" is piped to stdin of the ssh process. No second ssh connection. Also, no deletion of the file on the server, as there is no file. Also, no need for `lpr -r ...' that another poster mentioned, as there is again no file. I also changed the AppleScript to tell "System Events" to display the dialog, instead of Finder as that is old and incorrect. At the same time, I re-wrote the dialog to a) not add unneeded information (i.e. "Server's lpr said..."), which may be wrong (i.e. "Server's lpr wanted to say: `ssh: connection failed`") and b) to be all in one argument because it saves a few nano-seconds processing time for osascript (which is dog slow) and it makes it easier to read. It is rather superfluous to inform the user of an error in deletion, as the file is in /tmp anyway and will be cleared at a later time, so I just removed that part. I still maintain the return value, should anyone care. Just no useless information. I haven't looked, but if PDF services provides the name of the application doing the printing, then the AppleScript should use *that* application to display the dialogs, not the Finder or System Events. Hope this works better for you! :-) ---
Print to Unix systems without direct printer access
You have to quote $printResult properly to get its content displayed in a dialog box. In addition to that, the exit status of SSH command should be checked as well. So, my suggestion:
---
Print to Unix systems without direct print er access does not quite work
I used this script from home with one modification to print on the printer in my office at work. I specified the name of the printer by modifying the lpr command to: lpr -Pmyprintername
Print to Unix systems without direct print er access does not quite work
The PDF file which is produced contains .pdf extension already (the temporary file is something like /tmp/printing.123456/Print job.pdf, filename being always "Print job.pdf") so you shouldn't have to append the .pdf extension by hand. Try adding -p option to lpr command.
Print to Unix systems without direct print er access does not quite work
It sounds more like your printer doesn't understand PDF natively. That's not at all surprising - most big lasers only speak Postscript and plain ASCII. My department's printers are new this year; the old ones didn't do PDF. As I suggested, you'll need to include pdf2ps or something similar in the process; off the top of my head I don't know the best way to do that. I'm sure some of the more skillful Bash users who've already posted here can help.
Print to Unix systems without direct printer access
As I said to Fenner, this was a quick hack. So I'm not remotely worried about things like the number of SSH connections opened - if I'm using this then clearly I'm in the same building as the server so latency isn't an issue. Your use of stdin across the network is nifty, though - I didn't realise ssh did that. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.12 seconds |
|