User manual - Scripting_Guide

NAURTECH SMART CLIENTS FOR WINDOWS CE AND POCKET PC
CETerm Scripting Guide Page 61
var F = OS.File;
// Check if file exists
var attributes = F.GetAttributes( filename );
if (attributes != 0xFFFFFFFF)
{
var content = F.Read( filename );
status = F.Write( filename, content + addedContent );
}
else
{
status = F.Write( filename, addedContent );
}
return status;
}
5.7 ACCESSING THE REGISTRY
The registry on a Windows CE device is a form of database which contains most
of the device configuration. The Registry automation object allows you to
read, write and delete registry keys and values.
WARNING: Altering the registry can make your device unusable. Be sure you
know the effect of changing values and accept the responsibility.
The registry has a hierarchical structure. The “keys” are similar to file folders and
the “values” inside a key are similar to files in a folder. Several Registry
methods require a “fully qualified” value name which contains the full key
hierarchy, begins with a “root” key, and ends with the value name. This fully
qualified value name is similar to a file name with the full path.
The following example creates a new key and value and confirms that it can be
read.
/* NewRegistryDWORD */
function NewRegistryDWORD( keyname, valuename, valuedata )
{
var status = false;
var R = OS.Registry;
// Check if file exists
var fullyQualifiedKey = "HKEY_LOCAL_MACHINE\\" +
keyname + "\\" + valuename;
if (!R.WriteValue( fullyQualifiedKey, valuedata, "REG_DWORD" ))
{