Printing a TIFF from Preview

Hi everyone -

I have a problem. I need to print a TIFF image without buying software. The following script works…

set theFile to POSIX path of "/Path/To/MyFile.tif"
do shell script "lpr -P myPrinterName " & quoted form of theFile

…but only prints the first page. This is for printing faxes that are being delivered as TIFFs.

So, what I really want to do is this:

tell application "Preview"
	activate
	open theFile
	print front window
end tell

But, because Preview is not applescriptable, this doesn’t work. Does anyone else have a workaround? Any advice? All I need to do is make AppleScript print all pages of a document to a specified printer.

Thanks!

Does this work for your?

tell application "Finder" to print alias "path:to:file.tif"

This should instruct the Finder to open the file in its default app (eg, Preview) and send a print event (will print in default printer with default settings; I think you can modify these “default” settings, ask if needed).

Cool, that worked. Now, is there a good way to tell it what printer to print to? I have a script for another application that changes the default printer by opening the print settings app. Would that be my best bet?

Thanks!

Yes, I think :smiley:

Printing is the poor-est thing supported in AppleScript of all times, I think. Only a few applications implemented serious print settings, and we allways relied on third-party osaxen or scriptable apps to setup the default printer (back in OS 9 days). We have now some more help, but it’s still incomplete :mad:

Another way to go for printing faxes is to use eFax messenger: http://a248.g.akamai.net/f/248/528/15m/images.j2.com/twa/efxsetup3.dmg

I think it works with any fax.