File Commands SECTION 6 Functions and Methods
84
TFile = SelectFile("Text Files (*.txt;
*.csv)|*.txt;*.csv|Document Files (*.doc)|*.doc||")
In this example, the 'Files of type' filter has 2 choices: one to show text files
(i.e. both .txt and .csv files), and one to show document files (just .doc files).
TFile = SelectFile("", "C:\WINDOWS")
The 'File Open' dialog will be displayed, showing all files in the
"C:\WINDOWS" directory.
6-9-11 Write
Syntax
returnstate = Write(RecordId, pointname, ...)
Remarks
Typical Examples
WroteOK = Write(indexno, $Second)
The point '$Second' is written to the currently open file using the value of
indexno as an index into the file. Pass or fail status is stored in 'WroteOK'.
Write(2, $Second, $Minute, $Hour)
The points '$Second', '$Minute', '$Hour' are written to the currently open file
using the value 2 as an index into the file.
Note:It is advisable to use a RecordId less than 1024 whenever possible, in
order to optimise file access time (records 0 to 1023 are cached).
6-9-12 WriteMessage
Syntax
returnstate = WriteMessage("filename", offset, "text",
linefeed)
Remarks
Argument Type Description
returnstate bool Returnstate is '1' if the function is successful, or
'0' otherwise.
RecordId integer An index into the file.
Pointname point Name(s) of point(s) containing data to write to
the open file.
Argument Type Description
returnstate bool Returnstate is '1' if the function is successful, or
'0' otherwise.
filename string Pathname of file to be written.
offset integer An offset from the beginning of the file (in
characters) indicating where to start writing. If
the offset is -1 then the message is appended
to the end of the file.
text string The text to be written into the file.
linefeed bool A flag to indicate a carriage return and line feed
should be appended.