Saves the current Log window contents to a file.
enSaveLog = SaveLog ( sFilename, bAppend )
The SaveLog procedure syntax has the following parts:
Name |
Type |
Description |
enSaveLog |
enumALogSave |
Return the status of the save function |
sFilename |
Val BString |
File name to save the contents of the log window |
bAppend |
Val Bool |
When True the function will append the log window content to the specified file. Default value is False - overwrite the file contents. |
enumALogSave can have one of the following values:
Name |
Value |
Description |
alogSaveOk |
0 * |
Successful save |
alogSaveCanceled |
1 |
User selected Cancel when prompt to provide a file name to select |
alogSaveFailed
|
2 |
Failed to save the file since the Log variable is Nothing or ATEasy cannot create, open or save the specified file |
If the sFileName parameter is omitted, the Save As dialog box will appear asking the user to select a file name and file type.
The saved file format is determined by the following rules:
If sFileName has an filename extension of "txt", for example, mylog.txt, then the log will saved as text format, overriding the PlainText property.
If sFileName has an extension of "htm", then the log will be saved as HTML format, overriding the PlainText property.
If sFileName has an extension of "mht", then the log will be saved as Web Archive Single .mht file format, overriding the PlainText property. (v7.0)
If any other filename extension is used for sFileName, the log will be saved according to the format specified by the PlainText property.
If the sFilename is given without a directory, the file is saved to the application current directory.
When running the application as a stand alone mode (EXE file) the Log internal variable must be set to an application Form Log control. If the Log variable is empty (Nothing), the function return alogSaveFail.
Calling Log.SaveAs is similar to calling this function.
The following example saves the Log to a file name made up from the serial number entered by the user.
OnEndProgram ( )
{
sSerNum=GetProgramSerialNum()
if SaveLog(Left(sSerNum, 8)+".LOG")=alogSaveFailed
MsgBox("error saving log file")
endif
}