EasyManua.ls Logo

Topcon OPUS A6G2 - Page 539

Topcon OPUS A6G2
800 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
539
OPUS Projektor Manual
JavaScript
// Setting a new name to a DDO:
var worked = setProperty(DDOID, "Name", "MyNewName");
if (worked === true)
{
print("Setting new name worked!");
}
else
{
print("Setting name failed!");
}
// Set the background color:
worked = setProperty(DDOID, "Background Color", myColor);
// Set a new background image
worked = setProperty(DDOID, "Background Image",
"/opt/images/bg.png");
readFile - read the contents of a file
The contents of a file on the file system or external media can be read and stored in a vector
containing strings. Each vector entry represents one line of a file. If the reading was not
successful, the result is undefined.
Important note: The current maximum line length that is read is 1024 characters. If the file
contains a line that is longer, it is possible that the file can not be read correctly
Important note 2: The maximum number of bytes is currently restricted to 2MB. If the file is
larger than 2MB, only the first 2MB of the file are read, the rest is discarded.
Prototype:
var result = readFile(string filePath);
Example:
//read the contents of the file /proc/cpuinfo
var myData = readFile("/proc/cpuinfo");
//check if successful:
if (undefined == myData)
{
//reading failed!
print("Error reading file /proc/cpuinfo");
}
else
{
//reading successful, myData is now an array
//print contents to console:
for (var i = 0; i < myData.length; i++)
{
print("Line " + (i + 1) + ": " + myData[i]);
}
}
To display the contents of the retreived vector the Table Object can be used:

Table of Contents