PIPE

<< Click to Display Table of Contents >>

Navigation:  Gekko User Manual > Gekko statements >

PIPE

Previous pageReturn to chapter overviewNext page

Redirects output to a file (or back to the screen). Directing to a .html file is supported.

 

If you are going to pipe only parts of your Gekko output to an external file, it is recommended to start at pipe with PIPE [filename];, and then use pipe<pause>; and pipe<continue>; to start and stop piping to the file (and pipe<stop>; at the end of the session). If you instead use pipe<stop>; and pipe [filename]; to switch piping to the same file off and on, the external file may become blocked (and the program will run slower, too).

 

If you just want to suppress screen output, without directing it to an external file, you may use option interface mute = yes; (if PIPE is used, the file writing is suppressed).

 

 


 

Syntax

 

pipe < HTML  APPEND  PAUSE  CONTINUE  STOP > filename ;

 

HTML

(Optional). If this option is used, Gekko will insert the text into the <body> of an existing html file (if appending), or create a html file from scratch to write into. Note that Gekko appends text to the .html file without any prior formatting. So for instance to append a line to a .html file, you have to include the html tags (for instance: tell '<p>Hello</p>';). Html output is reasonably simple to convert into pdf.

APPEND

(Optional). If this option is used, the output will be appended to an existing file, otherwise the file is overwritten (if it exists to begin with).

PAUSE

(Optional). Sets piping on pause

CONTINUE

(Optional). Starts piping again

STOP

(Optional). Stops piping altogether.

filename

(Optional, not used with PAUSE, CONTINUE, STOP options).

Filenames may contain an absolute path like c:\projects\gekko\bank.gbk, or a relative path \gekko\bank.gbk. Filenames containing blanks and special characters should be put inside quotes. Regarding reading of files, files in libraries can be referred to with colon (for instance lib1:bank.gbk), and "zip paths" are allowed too (for instance c:\projects\data.zip\bank.gbk). See more on filenames here.

 

Any pre-existing file with the same name will be overwritten, unless option APPEND is used. If PIPE<stop> is used, the output is re-directed to the screen.

 

 


 

Example

 

You may want to keep a print of some variables in an output file:

 

read adambank;
pipe ex.out;
prt fy ul;
pipe <stop>;

 

The file ex.out now contains the variable print. If you instead use pipe <append> ex.out;, the existing ex.out file will be appended to.

 

The following illustrates piping to html:

 

pipe <html> out.html;
tell '<p>This is the first line</p>';
tell '<p>This is the second line</p>';
pipe <stop>;

 

Afterwards, you may open out.html in a web browser to see what it looks like. If you need to pause and continue piping, you may use this:

 

pipe text.txt;
tell 'a';
pipe<pause>;
tell 'b';
pipe<continue>;
tell 'c';
pipe <stop>;

 

After this, the file text.txt only contains 'a' and 'c', but not 'b'. If you put TELL statements between PIPE<continue> and PIPE<pause> statements, you will make sure that only the TELL's end up in the file.

 

 


 

Note

 

When piping, any error messages are also piped to the file. You may consult the 'traffic lights' in the lower right corner of the Gekko window, in order to see if an error occurred and the program aborted (in that case, the light will be red - a running program is shown as yellow).

 

 


 

Related options

 

OPTION folder pipe = [empty];

OPTION interface mute = no;