Click to expand/collapse this hidden textNewFile(Name:string);

Procedure

EscapeE only.

NEWFILE starts a new output file for this page. (NAME is currently ignored)

Click to expand/collapse this hidden textOpenFile(Name:string):fileHandle;

Function

OPENFILE returns a handle to a text file for reading. Use the handle in READLINE, READCSV and EOF functions.

Example

h:=openfile('test.txt');
while not eof(f) do
 begin s:=readline(h); writeln(s); end;

Example

Table example: Variable data

Click to expand/collapse this hidden textReadLine(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.

Click to expand/collapse this hidden textReadCSV(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.
If SEPARATOR is not specified then a comma is used to separate the elements. Each element will contain a field from the CSV record.

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.

Example Table example: Variable data

Click to expand/collapse this hidden textEOF(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.

Example Table example: Variable data

Click to expand/collapse this hidden textCreateFile(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.

Click to expand/collapse this hidden textWriteLine(var Handle:number;S:string);

Procedure

WRITELINE writes a string S to a file previously opened with CREATEFILE function (see above).

Click to expand/collapse this hidden textCloseFile(Handle:number):boolean;

Function

CLOSEFILE closes a file previously created with CREATEFILE function.

Click to expand/collapse this hidden textFileExists(FN:string):boolean;

Function

FILEEXISTS returns TRUE if the file – specified by the file named by FN string – is extant.

Example Table example: Variable data

Click to expand/collapse this hidden textResource(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.
X optional number of pixels at 600dpi, default 0 (left-hand side of page).
Y optional number of pixels at 600dpi, default 0 (top of page).
SCALE optional number, default 1 (i.e. unscaled).
PAGE optional number, default 1.
TRANSPARENT optional boolean, default TRUE.
CLIPLEFT, CLIPTOP, CLIPRIGHT and CLIPBOTTOM are optional numbers (default 0) specifying a clip region.

Example To draw a graphic at the top left-hand corner of the page:

resource('TEST.PNG');

See also RESOURCEPDF, below.

Click to expand/collapse this hidden textResourcePDF(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.
X optional number of pixels at 600dpi, default 0 (left-hand side of page).
Y optional number of pixels at 600dpi, default 0 (top of page).
SCALE optional number, default 1 (i.e. unscaled).
PAGE optional number, default 1.
TRANSPARENT optional boolean, default TRUE.
CLIPLEFT, CLIPTOP, CLIPRIGHT and CLIPBOTTOM are optional numbers (default 0) specifying a clip region.

Example In this example, the 50-page PDF output file is only a little larger than the 1-page source:

// REDTITAN RS2 CONTROL

resourcePDF('overlay.pdf');
text(100,100,'Page '+paramstr(1));

if paramstr(1)='50' then halt(1);

See also RESOURCE, above.