key.settings.callback

getKey(id).settings.callback( command ) or getKey(id).settings.callback( command1, command2 ) Will execute the command(s) whenever a key corresponding to the element is pressed. Example: [js highlight=”7-17″ try=”true”]newText(“sentence”, “Hello world”) .print() , newVar(“word”, 0) , newKey(“control”, ” \n\r”) .settings.callback( getText(“sentence”) .settings.color(“red”) , newTimer(1000) .start() .wait() , getText(“sentence”) .settings.color(“black”) )[/js] Prints Hello world onto the page and will highlight …

standard.setVar

getElement(id).setVar( varName ) (since beta 0.3) Stores the current value of the element in the Var element named varName (if it exists). What the current value corresponds to is specific to each element type: For Audio elements, it corresponds to the timestamp of the end of the last playback so far (0 if never played …

standard.settings.log

getElement(id).settings.log() Will add lines to the results file reporting element-specific events. See each Element page to see what gets recorded, and which parameter you can pass to log. For , and the results lines will report the timestamp corresponding to when print was called (if it was called). Example [js highlight=”6″] newButton(“go”, “Go!”) .print() .wait() …

standard.settings.enable

getElement(id).settings.enable() Enables any interactive feature of the element that was previously disabled. Example: [js highlight=”8″ try=”true”] newAudio(“sentence”, “test.mp3”) .settings.once() .print() , newKey(“secret key”, “R”) .wait() , getAudio(“sentence”) .settings.enable() [/js] Prints buttons to play/pause the audio file test_sentence.ogg, and disables those buttons when the file has played through (see ).

standard.settings.disable

getElement(id).settings.disable() Disables any interactive feature of the element. Note: this does not prevent an element that is part of a from being selected. Example: [js highlight=”6″ try=”true”] newAudio(“sentence”, “test.mp3”) .print() .wait() , getAudio(“sentence”) .settings.disable() [/js] Prints buttons to play/pause the audio file test_sentence.ogg, and disables those buttons when the file has played through.

key.test.pressed

getKey(id).test.pressed() or getKey(id).test.pressed( string ) or getKey(id).test.pressed( string , “first” ) (since beta 0.3) or getKey(id).test.pressed( number ) or getKey(id).test.pressed( number , “first” ) (since beta 0.3) Tests whether a key was pressed. If you pass no argument, it will yield success if any (valid) key has been pressed since the creation of the Key …

key.settings.log

getKey(id).settings.log() or getKey(id).settings.log(“wait”) (since beta 0.4) or getKey(id).settings.log(“first”) (since beta 0.4) or getKey(id).settings.log(“last”) (since beta 0.4) or getKey(id).settings.log(“all”) A line will be added to the results file indicating which key was pressed when. If you leave the parentheses blank or pass “wait” (those are equivalent) then key presses will only be logged if they validate …

key.wait

getKey(id).wait() or getKey(id).wait(“first”) or getKey(id).wait(test) Waits until a key is pressed. If you call wait(“first”), then if a valid key has been pressed since the creation of the key element, the next commands are evaluated and executed right away. If no valid key was pressed in the meantime, the next commands are only evaluated and …