EasyManua.ls Logo

Cognex DataMan - Function Encode_Base64; Error Management; Formatting Script

Cognex DataMan
76 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...
var ctrl_b = decode_sequences("\\Ctrl-B;");
function onResult (decodeResults, readerProperties, output)
{
if (decodeResults[0].decoded)
{
output.content = ctrl_b+decodeResults[0].content+ctrl_b;
}
}
Note: The backslash for initiating the escape sequence must also be escaped in the input string. The terminating
semicolon is necessary to be able to distinguish between sequences with the same prefix, otherwise key
sequences could be interpreted arbitrarily, e.g. there would be no means to detect if \KF11 means "press F11" or
"Press F1 followed by a one”. If a wrong or incomplete sequence is used, the two characters which mark the escape
sequence are ignored. In this case, the first two letters of the escape sequence are skipped and the remaining
characters will be sent. For example, the sequence "\ALT-M11;" is invalid and will result in displaying "LT-M11;".
Function encode_base64
This global function is used to encode a string argument into base64 encoding. The encoded result is returned as a
string object.
Parameter Type Description
inputString
string Input string to encode into base64.
Error Management
Scripting errors may occur when the script is loaded or the code parser function is called. These errors are shown in the
following locations:
l device log
l error box in Script-Based Formatting window
Formatting Script
When script-based formatting is enabled, a user-defined JavaScript module is responsible for data formatting. The
parsing function, which defaults to onResult, is called with three objects as arguments holding the array of DecodeResult
objects, ReaderProperties objects such as trigger mode or statistics, and the output object. There is only one entry point
for both single and multicode results.
Class hierarchy is structured in the following way:
function onResult [decodeResults, readerProperties, output]
DecodeResult
SymbologyProperties
Point
ValidationResult
GS1Validation
DoDValidation
QualityMetrics
Metric
ReaderProperties
Trigger
Statistics
28
DataMan Application Development

Table of Contents

Other manuals for Cognex DataMan

Related product manuals