2020.2

Table Of Contents
loadtext(location)
Returns the content of a text file. The file extension doesn't have to be .txt. It may also be a
JavaScript file (.js) or a style sheet (.css), for instance.
location
String containing a path that can either be a URL or a path that is relative to the
section/context.
In order to retrieve files from outside the template the file protocol is supported as well as the
http/https protocols.
The complete syntax of a fully qualified URL with the "file" protocol is: file://<host>/<path>. If
the host is "localhost", it can be omitted, resulting in file:///<path>, for example:
file:///c:/somefolder/somecontent.js.
Examples
This script loads a JavaScript file (from the Resources pane) directly into a <script> element.
var js = loadtext("js/my-script.js");
results.append(query("<script>").text(js));
The following script loads a style sheet (from the Resources pane) into the <style> element.
var css = loadtext("css/my-styles.css");
results.append(query("<style type='text/css'>").text(css));
logger
This is a global ScriptLogger object that allows logging messages such as error, warning or
informational messages. The messages will appear in the Messages pane (see "Preflight
Results and Messages" on page1045 and "Designer User Interface" on page922).
Methods
These are the methods of the logger object.
Method Parameters Description
error()
message: string
Logs an error message
Page 1289