10.3: Fax from command line (or AppleScript)

Dec 05, '03 09:50:00AM

Contributed by: Anonymous

I was working on this to be able to fax from Filemaker with FM scripting and AppleScripting. I needed to print to a file (a .ps file), then send the resulting file to the fax. Fax is actually a CUPS print queue, and I just needed to find the proper command to send with a do shell script command in AppleScript.

The fax command, after much digging and trial and error, is:

 lp -d cups_queue_name -o phone=number filename
-d lets you specify the print queue to use, -o is indicating that you are sending options to the printer; in this case the phone number to fax to. My fax queue name is Internal_Modem (I used lpstat -p -d in the Terminal to find the appropriate queue name) so the command I used to fax a document from my desktop is:
 lp -d Internal_Modem -o phone=222-3333 ~/Desktop/filename.ps
This sent the fax to the fax queue just like using the Fax... button on the Print dialog. So now all I have to do is construct the appropriate do shell script command in an AppleScript (I did this in a FileMaker script step). Also, there likely is a way to set all of the options that are available in the Fax dialog, but all I needed was to get the phone number to the print command, as I had formatted the coverpage with the FileMaker layout.

Comments (14)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031128150928128