
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Faxual II for CA-Clipper - faxsend
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
FaxSend
Send a fax
------------------------------------------------------------------------------
Syntax
FaxSend(<nDev>, <cPhone>, <acFiles> | <cFile>...) -> lOK
Parameters
<nDev> is a fax device number.
<cPhone> is the phone number to dial.
<acFiles> is an array of names of fax files.
<cFile> is the name of a fax file.
Returns
.T. if the job started successfully, .F. if there is an error.
Description
FaxSend() starts a fax job. The actual transmission take place in the
background; FaxSend() returns as soon as the job is started.
<cPhone> is the phone number to call to send the fax. It can be an
empty string, in which case the modem will pick up and try to send
immediately without dialing first. Most modems accept the following
characters in a dial string in addition to digits:
P Switch to pulse dialing for the following digits.
T Switch to tone dialing.
, Pause, usually 2 seconds.
! Flash (put the phone on hook for 1/2 second).
W Wait for another dial tone.
You can specify one or more fax files to send, by passing either an
array of file names, or a list of one or more names separated by commas.
All the files in one job must have the same page width and resolution.
Errors
Errors in FaxSend() can be reported in four different ways, depending on
the type of error and when it occurs.
. If a parameter is missing, or of the wrong type, or if the device
number is invalid, an error will be thrown using the Clipper error
system.
. If the fax device is busy, FaxSend() will return .F., and F2Error()
will return the appropriate error code (4001, "Fax device in use").
. Next, FaxSend() will pre-check the files, to make sure that they are
valid and that all parameters (page width, resolution) match, and to
determine total number of pages and job size. If an error occurs
during this phase, FaxSend() will return .F. with an error code in
F2Error(), and the device status (FaxStatus(), StFilename(), etc.)
will show where the error occurred.
. If all goes well, FaxSend() now returns .T. and fax transmission
begins in the background. Errors after this point are reported by
the device status functions.
Example
// Initialize serial port and fax device.
SerOpen(2)
FaxPort(1, 2)
FaxSpeed(1, 38400)
FaxLocalId(1, "+1 818 986 6108")
// Send the fax.
if .not. FaxSend(1, "986-5411", "coverpag.tif", "essmemo.tif")
? "FaxSend failed: " + F2ErrorMessage(F2Error())
quit
endif
// Wait for it to complete.
do while FaxDriver()
// Press ESC to cancel.
if inkey() == 27
FaxCancel(1)
endif
enddo
// Show the result.
if StError(FaxStatus(1)) == 0
? "Fax completed successfully"
else
? "Trouble: " + F2ErrorMessage(StError(FaxStatus(1)))
endif
// Reset the device for the next transmission.
FaxReset(1)
See Also: F2Error FaxStatus
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson