Files and resources
NewFile(Name:string); |
Procedure EscapeE only. NEWFILE starts a new output file for this page. (NAME is currently ignored) |
OpenFile(Name:string):fileHandle; |
Function OPENFILE returns a handle to a text file for reading. Use the handle in READLINE, READCSV and EOF functions. |
|
h:=openfile('test.txt'); |
|
ReadLine(var Handle:fileHandle):string; |
Function READLINE returns the next string read from the file specified by the HANDLE identifier (created by OPENFILE). See also READCSV below. |
ReadCSV(var Handle:fileHandle;var Lx:list;[Separator:string[1]]); |
Procedure READCSV returns the next CSV record from the file specified by the HANDLE identifier (created by OPENFILE) in the list specified by LX. A multi-line field is normalized to a string containing a number of lines delimited by 'Line Feed' (#10) characters, i.e. 'CR' (#13) is not stored. Use the SPLIT function to decompose multi-line fields. |
EOF(var Handle:fileHandle):boolean; |
Function EOF tests if any more data can be read from a file previously opened using OPENFILE. If EOF fails, the HANDLE is no longer valid, and the file is closed. |
CreateFile(FileName:string):fileHandle; |
Function CREATEFILE creates a file named FILENAME and returns a handle that can be used for WRITELINE procedure and CLOSEFILE function. Tip: "CREATEFILE WRITELINE WRITELINE CLOSEFILE" summarizes the file create process. |
WriteLine(var Handle:number;S:string); |
Procedure WRITELINE writes a string S to a file previously opened with CREATEFILE function (see above). |
CloseFile(Handle:number):boolean; |
Function CLOSEFILE closes a file previously created with CREATEFILE function. |
FileExists(FN:string):boolean; |
Function FILEEXISTS returns TRUE if the file – specified by the file named by FN string – is extant. |
Resource(FN:string; [X,Y:number;[Scale:number;[Page:number;[Transparent:boolean[,ClipLeft,ClipTop,ClipRight,ClipBottom:number]]]]]):boolean; |
Function EscapeE only RESOURCE function adds the designated resource to the EscapeE page. If the resource cannot be found, or the requested page does not exist in the file, the function returns FALSE. FN must be the name of a file in a format that EscapeE can view (PCL, PDF, TIFF, RS2 etc.) and is mandatory. To draw a graphic at the top left-hand corner of the page: resource('TEST.PNG'); See also RESOURCEPDF, below. |
ResourcePDF(FN:string; [X,Y:number;[Scale:number;[Page:number;[Transparent:boolean[,ClipLeft,ClipTop,ClipRight,ClipBottom:number]]]]]):boolean; |
Function EscapeE only RESOURCEPDF function is used to engage special processing for PDF export only. The RESOURCEPDF File Name is only stored once in the output file and the content reused by each page as an embedded resource. If the resource cannot be found, or the requested page does not exist in the file, the function returns FALSE. FN this string expression specifies the resource's File Name and is mandatory. In this example, the 50-page PDF output file is only a little larger than the 1-page source: |
|
|
|
See also RESOURCE, above. |