Script TheSky
Version 1.32
|
Public Slots | |
int | createNew (QString fileNameWithOutExtension) |
Creates a new text file. More... | |
int | openForAppend (QString fileNameWithOutExtension) |
Opens an existing text file for appending. More... | |
int | openForRead (QString fileNameWithOutExtension) |
Opens an existing text file for reading. More... | |
void | close (void) |
Close the text file. | |
QString | readAll (void) |
Reads the entire content of the text file, and returns it as a string. More... | |
QString | readLine (void) |
Reads a line of text and returns it. More... | |
bool | write (QString qsOut) |
Write a string to the text file. More... | |
The TextFile object.
The TextFile object provides basic scripted access to a text file. This object by no means offers general purpose text file operations but rather limited scope while still offering the scripter a useful, powerful tool. The following restrictions apply 1) the file name can only contain letters and or numbers 2) the file size on write is limited 3) the path of the file is fixed 4) the extension of the file is fixed (see createNew() for all the specific details).
The TextFileExample.js sample script demontrates use of this object.
This object was added in TheSky build 10055 (see Application::build).
|
slot |
Creates a new text file.
Calling this method truncates an existing file with the same name.
[in] | fileNameWithOutExtension | the desired file name without an extension. The file extension .txt is automatically appended and cannot be changed. The file name can only contain letters and or numbers. The path to the file is fixed and cannot be changed. On Windows the file fixed path is /My Documents/Software Bisque/TheSkyX Professional Edition/ScriptFiles for TheSkyX 32 bit (otherwise "/TheSky Professional Edition 64/") . On Mac the fixed path is /Library/Application Support/Software Bisque/TheSkyX Professional Edition/ScriptFiles The file size is limited to 4 MB when writing. |
|
slot |
Opens an existing text file for appending.
[in] | fileNameWithOutExtension | see createNew() |
|
slot |
Opens an existing text file for reading.
[in] | fileNameWithOutExtension | see createNew() |
|
slot |
Reads the entire content of the text file, and returns it as a string.
Avoid this function when working on large files, as it will consume a significant amount of memory. This method returns an empty string if the file is opened with createNew() or openForAppend().
|
slot |
Reads a line of text and returns it.
This method returns an empty string if the file is opened with createNew() or openForAppend().
|
slot |
Write a string to the text file.
Returns true if the write succeeded or false if the write fails.