FAXability API

Solutions

FAXability supports an API that allows you to customize and automate the message preparation process.  When a new message is created, fax recipients, the subject, cover text and attachments can all be added to the message through the API.  A message that's constructed using the API can be sent automatically, or it can be left for the user to send manually.

The FAXability API can be applied uniquely for the four different ways that new messages are created: normal send, print-capture, forward and resend.  For example, it's possible to automatically set the cover text in a new message to the contents of a file when a message is created as the result of printing to the "FAXability" printer, but not when you select Fax->New Fax from the main menu.

How It Works

When a new message is created, FAXability examines a registry value based on the current message preparation process: normal send, print-capture, forward and resend.  If found, the registry value must be set to the name of a JavaScript file that FAXability can load and execute.  FAXability executes the script in same context as the new message, allowing the script to modify all aspects of the message.  Unless instructed otherwise, FAXability will delete the script file after script execution has finished. 

The four possible registry values are as follows.  Each registry value can be set to reference the same JavaScript file, or different files, all depending on the desired functionality.

Script Command File Registry Values:
[HKEY_CURRENT_USER\Software\FaxBack\FAXability]
"SendCommandFile"="<script command file>"
"PrintCaptureCommandFile"="<script command file>"
"ForwardCommandFile"="<script command file>"
"ResendCommandFile"="<script command file>"     

Examples

FAXability supports a set of functions that allow script in a command file to modify a new message in several ways (see API Reference below for a complete list).  The following examples demonstrate how these functions can be combined.  Keep in mind that these are JavaScript files, and that all JavaScript language features such as comments, loops and conditions can be used.

Example #1:
// Simply sets the subject for normal send messages
//
// Saved as file "C:\MyScripts\SetSubject.js"
// The registry is set as follows:
//   [HKEY_CURRENT_USER\Software\FaxBack\FAXability]
//   "SendCommandFile"="C:\\MyScripts\\SetSubject.js"

CmdSubject("Information You Requested");
CmdNoDeleteCmdFile();
Example #2:
// Sets message contents
//
// Saved as file "C:\MyScripts\SetupMessage.js"
// The registry is set as follows:
//   [HKEY_CURRENT_USER\Software\FaxBack\FAXability]
//   "SendCommandFile"="C:\\MyScripts\\SetupMessage.js"

CmdCoverTextFile("c:\\MyScripts\\CoverText.txt");
CmdURL("http://company.com/promo/xyz.html");
CmdNoDeleteCmdFile();
Example #3:
// Automatically sends a print-captured attachment
//
// Saved as file "C:\MyScripts\PrintAndSend.js"
// The registry is set as follows:
//   [HKEY_CURRENT_USER\Software\FaxBack\FAXability]
//   "PrintCaptureCommandFile"="C:\\MyScripts\\PrintAndSend.js"

CmdAddress("Fred","555-123-1234","Stoneage, Inc.");
CmdAddress("Barney","555-123-5432","");
CmdNoDeleteCmdFile();
CmdSendFax(); 

API Reference

CmdAddress

The CmdAddress function adds a fax recipient to the message.  Multiple recipients may be added to a message.

CmdAddress(
  Name // Name of recipient
  Address // Fax number of recipient
  Company // Company of the recipient (optional)
)


CmdAttachment

The CmdAttachment function adds a file attachment to the message.  Multiple attachments may be added to a message.

CmdAttachment(
  FileName // File name of attachment
  DisplayName // Display name of attachment
)


CmdCoverText

The CmdCoverText function sets the message cover text from a string.

CmdCoverText(
  Text // Cover text string
)


CmdCoverTextFile

The CmdCoverTextFile function sets the message cover text from a file.

CmdCoverTextFile(
  FileName // Name of file to be used as the cover text
)


CmdCoverRTFFile

The CmdCoverRTFFile function sets the message cover text, in rich-text format, from a file.  Cover text can include special formatting available from the rich-text format, such as font changes and embedded graphics.  However, some formatting made possible by sophisticated editors may be misinterpreted, so Wordpad should be used to create the rich-text (.RTF) file.

CmdCoverRTFFile(
  FileName // Name of file to be used as the cover text
)


CmdNoDeleteCmdFile

The CmdNoDeleteCmdFile function tells FAXability to not delete the command file after the script has finished execution.  For normal operation, the command file is deleted after the script has finished execution.  This function can be called anywhere in the script file to prevent FAXability from deleting the script file.

CmdNoDeleteCmdFile()


CmdSendFax

The CmdSendFax function tells FAXability to send the current message.  Calling this function is equivalent to selecting File->Send Fax from the menu.  If there are any errors, for example, if no recipients have been added to the message, then a standard error message will be displayed that will require the user to take some action.

CmdSendFax()


CmdSubject

The CmdSubject function sets the message subject.

CmdSubject(
  Subject // New subject for the message
)


CmdURL

The CmdURL function adds a URL to the message.  The web page referenced by the URL must be accessible by the fax server in order for it to be converted to a fax image.  Multiple URLs may be added to a message.

CmdURL(
  URL // URL to fax with the message
)