Hiya folks. Somewhat new KiXtart scripter here. I have a script which occassionally returns me the following error text:

"Error (317 / 13D) while retrieving error information for FFFFFFFF"

I cannot understand why I get this error, as I do not understand WHAT the error refers to. I have tried some of the various scripts available here for listing error codes, and noticed they all filter out codes with "(317 / 13D)" in them.

Can anyone shed some light on this?

Code follows:
Code:

;*******************************************************************************************
;** Name :SplitFAx.kix
;*******************************************************************************************
;** TiffConvert.exe - used to split multipage fax images into mulitple files (one file per page)
;**
;** Usage: TiffConvert input output [-m] [-n] [-e ]
;** input name of file to convert
;** output name of converted file (without extension if multifile)
;** -m output will be multifile (one page per tiff file)
;** -n output pages will be normalized
;** -e encoding specify encoding to use for tiff image, possible values
;** are G3 and G4
;*******************************************************************************************

BREAK ON ; allows CTRL + C to end running scripts

;***************************************************************
;***** Variable Declarations **
;***************************************************************
GLOBAL $LOG_FILE $LOG_FILE = "G:\Eswitch\split_fax_error.log"
GLOBAL $ESWITCH_USER $ESWITCH_USER = "eSwitch"
DIM $ESWITCH_SCRIPT $SPLITFAX_SCRIPT = "G:\Eswitch\TiffConvert.exe"
DIM $LOG_MESSAGE
DIM $MAIL_SUBJECT

;***************************************************************
;*****Function LogError() to log error messages. **
;***************************************************************
FUNCTION Log($LogMessage, $LogFile)
$HANDLE = FreeFileHandle()
IF $HANDLE > 0
IF Open($HANDLE, $LogFile, 5) = 0
$x = WriteLine($HANDLE, $LogMessage + @CRLF)
Close($HANDLE)
ELSE
BEEP
? "Function: LogError - Error opening file " + $LogFile + " , error code : [" + @ERROR + "]"
ENDIF
ENDIF
ENDFUNCTION
;***************************************************************
;*****Function SendMail to send mail using SMTP (blat). **
;***************************************************************
FUNCTION SendMail($MailTo, $MailFrom, $Subject, $Body)
$MailString = 'blat ' + '"' + %BLATFILE% + '"' + ' -q -server ' + '"' + %SMTP_SERVER% + '"' + ' -tf ' + '"' + $MailTo + '"' + ' -f ' + '"' + $MailFrom + '"' + ' -s ' + '"' + $Subject + '"' + ' -replyto noone@dhltd.com -body ' + '"' + $Body + '"'
SHELL ($MailString)
ENDFUNCTION

;***************************************************************
;***** Split eSwitch Faxes into their component pages. **
;***************************************************************

SELECT

CASE CSTR($4)==$ESWITCH_USER

;******************************************************
;** This is an eSwitch fax, so rename received file. **
;******************************************************
$TEMPFILE = $1 + ".tmp"
$shellcommand = "cmd /c Move " + $1 + ".001 " + $TEMPFILE
SHELL $shellcommand
IF @ERROR <> 0
$LOG_MESSAGE = @DATE + " " + @TIME + " - Error in SplitFax.kix: Could not rename eSwitch Fax image file " + $1 + ".001" + " to " + $TEMPFILE + " -- Error = " + @ERROR + " " + @SERROR
Log($LOG_MESSAGE, $LOG_FILE)
$MAIL_SUBJECT = 'eSwitch Fax Error: Could not split file'
SendMail(%ESWITCH_MAINTAIN%, %ES_EMAIL_FROM%, $MAIL_SUBJECT, $LOG_MESSAGE)
EXIT
ENDIF

;*******************************************************
;** Split the received file into its component pages. **
;*******************************************************

$shellcommand = $SPLITFAX_SCRIPT + " " + $TEMPFILE + " " + $1 + " -m"
SHELL $shellcommand
IF @ERROR <> 0
Log($LOG_MESSAGE, $LOG_FILE)
$MAIL_SUBJECT = 'eSwitch Fax Error: Could not split file'
SendMail(%ESWITCH_MAINTAIN%, %ES_EMAIL_FROM%, $MAIL_SUBJECT, $LOG_MESSAGE)
EXIT
ENDIF

;****************************
;** Delete the ".tmp" file **
;****************************
$shellcommand = "cmd /c Del " + $TEMPFILE
IF @ERROR <> 0
$LOG_MESSAGE = @DATE + " " + @TIME + " - Error in SplitFax.kix: Could not delete eSwitch Fax image file " + $TEMPFILE + " -- Error = " + @ERROR + " " + @SERROR
Log($LOG_MESSAGE, $LOG_FILE)
$MAIL_SUBJECT = 'eSwitch Fax Error: Could not split file'
SendMail(%ESWITCH_MAINTAIN%, %ES_EMAIL_FROM%, $MAIL_SUBJECT, $LOG_MESSAGE)
EXIT
ENDIF

CASE 1

;******************************************************************************
;** This is not an eSwitch fax, so delete the image file from "New" directory**
;******************************************************************************
$shellcommand = "cmd /c Del " + $1 + ".001"
SHELL $shellcommand
IF @ERROR <> 0
$LOG_MESSAGE = @DATE + " " + @TIME + " - Error in SplitFax.kix: Could not delete " + $1 + ".001 (non-eSwitch Fax) -- Error = " + @ERROR + " " + @SERROR
Log($LOG_MESSAGE, $LOG_FILE)
$MAIL_SUBJECT = 'eSwitch Fax Error: Could not split file'
SendMail(%ESWITCH_MAINTAIN%, %ES_EMAIL_FROM%, $MAIL_SUBJECT, $LOG_MESSAGE)
EXIT
ENDIF

ENDSELECT