kbLogger 2.0.b1
The automotive ready test and logging program.
ScriptObject

Description:
The ScriptObject is used for test automation. This script interpreter is a JavaScript implementation which comes with the usage of the Qt framework from from the Qt Group.

As described in the Qt documentation, QtScript is based on the ECMAScript scripting language, as defined in standard ECMA-262. Microsoft's JScript, and Netscape's JavaScript are also based on the ECMAScript standard. For an overview of ECMAScript, see the ECMAScript reference. If you are not familiar with the ECMAScript language, there are several existing tutorials and books that cover this subject, such as JavaScript: The Definitive Guide.

The JavaScript interpreter runs in its own thread. This makes it possible to use blocking functions like Script::sleep(). Since the ScriptObject uses an instance of the class Script with the name "so", which means "script object", the correct function call for this function is

so.sleep(sleepTime);

You can find more about the usage of the functions of the script object at its description.

Creating a ScriptObject:
Do a right-click on an empty place in the ConfigViewer of your project and choose "New ScriptObject".

Creating a new ScriptObject

Configure the ScriptObject:
Double click on the ScriptObject to open the configure dialog.

ScriptObject configure dialog

ScriptObject Name:
The edit field "ScriptObject Name" contains at first a generic name like "ConfigItem1". This user changeable name is used to identify the ConfigItem in the TraceViewer or LogViewer. This name can also be used as sender or receiver name for massages.

JavaScript File:
Click on the button "..." to choose a kbLoggerScript file (*.js) or to create a new one. This click will open the "Open script file" dialog.

In this dialog, you can navigate to the file to open. Select the chosen file and click on the button "Open".

To create e new one, right-click in a free place in the dialog and choose "Create New -> Text File". Select this new file and click on the button "Open".

The name of the chosen file will appear in the "JavaScript File" edit field.

If you want to edit the JavaScript file, click on the button "Edit", the configured The external TextEditor will open the file.

If you need to see for debugging purposes how the JavaScript files are included in each other, check the checkbox "Write intermediate Files". You will find such files in the project folder.