Page History: Key Logger Element
Compare Page Revisions
Page Revision: 2016/05/21 01:23
|
Key Logger Element
|
Info |
Category: |
Input Registration |
|
AddIn: |
Base Elements |
Creator: |
OkazoLab Team |
|
Scope: |
Parent Event |
Owns Snippets: |
yes |
|
Usage: |
Input,Snippets |
Actions aligned with epochs of the parent event
Epoch | Actions |
---|
After Onset | The element starts monitoring key presses and releases |
Before Offset | The element stops monitoring key presses and releases |
Properties
Generic properties
Name | Description | Constraints | Value Type | Upon Change |
---|
Settings |
Input Device | Defines the input device for key logging | | enum | |
Logging Mode | Defines what key events are recorded in the log | enum | |
Column Delimiter | Defines the column delimiter in the recorded key log | String | |
Add Line Breaks | Defines whether a line break is added at the end of each log record | Boolean | |
Autosave to DataReport | If true, the collected key log is automatically saved into the Data Report on the offset of the parent event | Boolean | |
Runtime Status |
Custom Columns | Defines a custom string that are added to the end of each log record. You can use this property to insert columns with extra information and sync markers (e.g. name of the current event) to the key log. | String | |
Key Log | | String | |
+=== Properties inherited from clElement ===
Inherited properties of clElement
Name | Description | Constraints | Value Type | Upon Change |
---|
Control |
Is Enabled | If set to false the element is completely omitted when the experiment is run. | | Boolean |
|
Title | Title of the element. | | String |
|
Key Logger element saliently registers and logs all button presses and releases made within the parent event.
Description
Use the Key Logger element, when you want to record all button events over a certain period in an experiment. The Key Logger elements carries logging saliently, so if you plan to handle button responses at run-time, you may prefer use either
Button or
HID input elements instead.
The Key Logger element creates an internal text log, in which each record denotes a button event. The record is composed of 3 columns: time, button name and button state.
Here is an example of the key log that recorded a press and subsequent release of the Space button.
Time (ms) | Button name | Button State (1-down,0-up) | Custom Columns |
---|
1034 | Space | 1 | Event1 |
1472 | Space | 0 | Event2 |
The column values are separated with a delimiter character that is defined by the
Column Delimiter property. By default, a line break is added to the end of each record.
The recorded log can be accessed by the
Key Log property that returns a current log content as a single string.
Practical Use
Deploying the Key Logger element
- Select the event in your experiment, in which you want to log all button presses and releases.
- Add the Key Logger element to that event
- Browse the button element properties in the property panel
- Select the Input Device, for example, the system keyboard
- Think of how you are going save the recorded key log (one example is given in the next section)
Saving the recorded key log into Data Report
- Add the Key Logger element to a event
- Browse the button element properties in the property panel
- Select the Input Device, for example, the system keyboard
- Create a proxy variable linked to the Key Log property
- Open the After Offset snippet of the parent event
- Add the following code to the snippet:
Report=KeyLog; // send the recorded key log into the data report
Notes
- Content of the key log is automatically cleared on every onset of the parent event
- Content of the key log is automatically cleared on every onset of the parent event
- You can use multiple key logger elements in the same time, for example, for parallel logging of the keyboard and mouse buttons
- Key Logger element uses the DirectX button name convention, the same as in the Button element