text.unfold

getText(id).unfold( delay ) (since PennController 1.3) Unfolds the text in delay milliseconds. Example: [js highlight=”2″ try=”true”]newText(“Hello world”) .unfold( 3000 ) , newTimer(3000) .start() .wait()[/js] Starts unfolding the text “Hello world” in 3s (which is very slow for only two words) and immediately starts a 3s timer and waits until it ends.

button.click

getButton(id).click() (since PennController 1.2) Simulates a click on the button. Example: [js highlight=”3,4″ try=”true”]newKey(” “) .settings.callback( getButton(“continue”) .click() ) , newButton(“continue”, “Continue”) .print() .wait()[/js] Creates a Key element associated with the spacebar which, whenever pressed, will simulate a click on the continue button added below it, then will wait until the button is clicked (or …

standard.settings.cssContainer

getElement(id).settings.cssContainer(“styleName”, “style”) or getElement(id).settings.cssContainer({“style name 1”: “style 1”, “style name 2”: “style 2″}) Applies the CSS style(s) to the container’s element. This will affect both the element itself and any element wrapping it as added via or . This command often more closely accomplishes what you want to achieve than the command. Example: [js highlight=”4″ …

scale.select

getScale(id).select(option) or getScale(id).select(index) or getScale(id).select(option, “log”) Selects the specified option on the scale. If you pass a second argument (e.g. “log”) then the selection will be treated as if it were a manual selection, and will be recorded in the results file if you called log. Example: [js highlight=”24″ try=”true”]newText(“What programming language is PennController based …

scale.settings.keys

getScale(id).settings.keys( “key1”, “key2”, … ) or getScale(id).settings.keys() Respectively associates the scale’s options with the specified keys for selection. If you pass no argument, will check whether your scale’s options are all single characters and, if so, will use them as keys. If not, will respectively associate the scale’s options with the numeric keys. Example: [js …

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 …

button.settings.callback

getButton(id).settings.callback( command ) or getButton(id).settings.callback( command1, command2 ) Will execute the command(s) whenever the button is clicked. Example: [js highlight=”5-9″ try=”true”]newVideo(“skate”, “skate.mp4”) .print() , newButton(“(Re)play”) .settings.callback( getVideo(“skate”) .stop() .play() ) .print()[/js] Adds onto the page a video and a button which, whenever clicked, starts or restarts playing the video from the beginning.

dropdown.settings.log

getDropDown(id).settings.log() or getDropDown(id).settings.log(“first”) or getDropDown(id).settings.log(“all”) Will add a line to the results file for the current trial reporting what option was selected. If you pass “first” as the argument, it will report the option selected upon first selection, ignoring further selections. If you pass “all” as the argument, it will add a line for each …

dropdown.test.selected

getDropDown(id).test.selected(option) or getDropDown(id).test.selected() Tests whether an option is selected. If you pass no option as an argument, then the test will succeed as long as any option is selected. If you pass a number, and provided there is no option whose text content corresponds to this exact number, it will test the index of the …

dropdown.settings.remove

getDropDown(id).settings.remove(“option”) Removes a single option from the list. Nothing happens if the option passed as an argument is in fact not in the list. Example: [js highlight=”17,18″ try=”true”]newDropDown(“value” , “Truth value”) .settings.add( “True” , “False” ) .print() , newScale(“logic”, “Binary”,”Three-valued”) .settings.default(“Binary”) .settings.before( newText(“Logic: “) ) .settings.labelsPosition(“right”) .settings.callback( getScale(“logic”) .test.selected(“Three-valued”) .success( getDropDown(“value”) .settings.add(“Other”) ) .failure( getDropDown(“value”) …