var fileResult = TW.readFile("path/to/file.txt");
relative paths are taken to be relative to the folder containing the
executing script's file
The return value fileResult is an object (a map) with three member properties.
(You can use any valid variable name and not just fileResult)
gives you the status code (same as for writeFile).
Upon success res.status == 0
fileResult.result contains the text of the file.
This would be undefined if there is no content.
fileResult.message will have one of the following responses in it:
And upon successful reading of file content:
In lua, fileResult.status
And so on.
In Python, the members are accessed as a dictionary fileResult['status']
And so on.
There is a setting for 'reading' permissions in the preferences dialog.
By default, global reading is disabled.
Files in the folder containing the
current script (e.g., <resources>/scripts/test/) and its sub folders are
always readable, as are files in the folder containing the current
target (tex/pdf) file's directory, its root (master) file's directory (if
used), and their sub folders.
Reference: Stefan Löffler http://tug.org/mailman/htdig/texworks/2010q4/003471.html
Stefan Löffler http://tug.org/pipermail/texworks/2010q4/003531.html
Created with the Personal Edition of HelpNDoc: Full featured Documentation generator