AppleScript & pagesender
pagesender includes support for automation via AppleScript as well as several reference examples.
Introduction to Scripting pagesender
pagesender is a printer driver. Scripting is done by establishing preset values (for example, a fax recipient's phone number) to be used by the pagesender printer driver for a particular application then forcing that application to print.
Some applications, such as TextEdit and OmniGraffle (and probably most other Cocoa applications), support printing without user interaction using the AppleScript "print" command. Three of the example scripts included with pagesender demonstrate this technique using TextEdit.
Other applications, such as FileMaker Pro and Microsoft Word, have their own internal scripting language which supports printing without user interaction. There's a FileMaker Pro example included with pagesender. For Microsoft Word, one strategy is to record a macro in the global template named say "PrintDocument" where all you do is print the current document then stop the recording. Now in AppleScript, you can get Microsoft Word to print without using interaction by using: do script "PrintDocument()". There are probably even better ways to do this using Visual Basic. Feel free to send feedback.
Example Scripts
Three example scripts and one FileMaker Pro database are included with pagesender. They are found in:
/Library/Printers/pagesender/AppleScript Examples.
E-mail from Script Example - Demonstrates using pagesender to automate E-mailing PDFs of whatever you can print. Note that you can set the subject and content using the email info class, and you can even set the recipient type of the email recipient if you'd like to add CC or BCC recipients.
Fax from Script Example - Demonstrates using pagesender to automate faxing whatever you can print. Note that you can set multiple cover pages, and you can add additional replacements to your custom cover pages.
Prefill Envelope Example - Demonstrates using pagesender to pre-fill the print dialog. Perhaps you wish to pre-fill the print dialog as a convenience yet allow the user to change things before sending. This shows you how.
FileMaker Pro Example - We're just casual FileMaker Pro users here at Smile Software, but we thought it would be useful to put together a basic scripting demo. The purpose of the example is to give an idea of how one might use pagesender to automate the E-mailing or faxing of invoices from a database. There are two layouts - Data Entry and Invoice, and there are two scripts - Fax Invoices and Email Invoices. The basic idea of the script is to find each data entry record individually, write a customized AppleScript to the global Script field, execute the script, print the invoice (thereby E-mailing or faxing it via pagesender), wait a moment for the print job to flow through the queue and repeat. This example was produced and tested in FileMaker Pro 5.5 and may not work with earlier versions of FileMaker Pro.Scripting experts - please feel free to send feedback.
Scripting Caveats
Here are some things to watch out for when scripting pagesender:
How do I learn AppleScript
Alas, that is beyond the scope of pagesender's online help. You can find a great many resources by starting at Apple's AppleScript Home Page. Happy scripting!