+

Search Tips   |   Advanced Search

Using binary values in scripting

Binary values can be retrieved from Attributes by using the getObject() function of the entry. The binary Attribute value itself is returned as a byte array. Here is a JavaScript example:

var x = conn.getObject("objectGUID");
for ( i = 0; i < x.length; i++ )
{
   task.logmsg ("GUID[" + i + "]: " + x[i]);
}
This example writes some numbers varying between -128 and 127 into the log file. You might want to do something else with your data. If you have read a password from a Connector, which stored it as a ByteArray, we can convert it to a string with this code:
password = system.arrayToString(conn.getObject("userpassword"));


Parent topic:

Java + Script ≠ JavaScript