tooltip.print

getTooltip(id).print() or getTooltip(id).print( getElement(id) ) (since beta 0.3) or getTooltip(id).print( x , y ) (since PennController 1.6) Adds the tooltip to the page, or attaches it to the referenced element (if any). Since PennController 1.6, you can pass x and y coordinates to print the tooltip at a specific point on the screen/document. [js highlight=”5″ …

timer.test.running

getTimer(id).test.running() (since beta 0.3) Tests whether the timer is currently running. Example: [js highlight=”22-24″ try=”true”] newTooltip(“not running”, “The timer is not running”) , newText(“on”, “[on]”) .settings.before( newText(“off”, “[off]”) ) .print() , newSelector(“switch”) .settings.add( getText(“on”) , getText(“off”) ) , newTimer(“quick”, 500) .settings.callback( getSelector(“switch”).select(getText(“off”)) ) , getSelector(“switch”) .settings.callback( getSelector(“switch”).test.selected( getText(“on”) ) .success( getTimer(“quick”).start() ) ) , newButton(“target”, …

timer.test.ended

getTimer(id).test.ended() (since beta 0.3) Tests whether the timer has ended. Example: [js highlight=”12″ try=”true”] newText(“start”, “Ready… go!”) .print() , newTimer(“hurry”, 1000) .start() , newButton(“click”, “Click me!”) .print() .wait() , getTimer(“hurry”) .test.ended() .success( newText(“slow”, “Too slow…”).print() ) .failure( newText(“fast”, “Good job!”).print() ) [/js] Adds a line of text saying Ready… go! to the screen, starts a …

timer.settings.log

getTimer(id).settings.log() Will add a line to the results file each time the timer starts and each time it ends. Example: [js try=”true” highlight=”5″] newText(“pleasewait”, “Please wait 1s.”) .print() , newTimer(“wait”, 1000) .settings.log() .start() .wait() , newButton(“continue”, “Now click here to continue.”) .print() .wait() [/js] Adds the text Please wait 1s to the screen, starts a …

timer.settings.callback

getTimer(id).settings.callback( element ) or getTimer(id).settings.callback( function ) Warning: until PennController beta 0.2, this command has a bug that freezes the script Will execute the function or element command when the timer has finished running for the first time. Example: [js try=”true” highlight=”8″] newText(“start”, “Ready… go!”) .print() , newButton(“click”, “Click me!”) .print() , newTimer(“hurry”, 1000) .settings.callback( …

timer.wait

getTimer(id).wait() or getTimer(id).wait(“first”) or getTimer(id).wait( test ) Waits until the timer has finished running before evaluating and executing the next commands. If you call wait(“first”), then if the timer has already completed a full run before this command is evaluated, the next commands are evaluated and executed right away. If the timer was never completed …

timer.start

getTimer(id).start() Starts the timer. Example: [js highlight=”5″ try=”true”]newText(“pleasewait”, “Please wait 1s.”) .print() , newTimer(“wait”, 1000) .start() .wait() , getText(“pleasewait”) .remove() [/js] The code above adds the text Please wait 1s to the screen, starts a 1000ms timer and wait until it is done before removing the text.

textinput.test.text

getTextInput(id).test.text(“string”) or getScale(id).test.text( /RegExp/ ) Tests for a match with the text in the input box. Example: [js highlight=”7″ try=”true”]newTextInput(“haiku”, “hatsu shigure\nsaru mo komino o\nhoshige nari”) .settings.lines(3) .print() , newButton(“save”, “Save”) .print() .wait( getTextInput(“haiku”).test.text(/^.+[\r\n].+[\r\n].+$/) )[/js] Adds a 3-line input box to the screen containing a haiku (note the \n to insert linebreaks in the text) …

textinput.settings.text

getTextInput(id).settings.text(“string”) (since beta 0.3) (Re)sets the text in the input box. [js highlight=”11″ try=”true”]newTextInput(“poem”, “”) .settings.before( newText(“flowers”, “Violets are blue, roses are red, “) ) .print() , newButton(“validate”, “Validate”) .print() .wait() .remove() , getTextInput(“poem”) .settings.disable() .settings.text(“DISABLED”)[/js] Adds a one-line input box to the screen preceded with Violets are blue, roses are red, on its left, …

textinput.settings.once

getTextInput(id).settings.once() Disables the input box after the key enter/return has been pressed for the first time while editing. [js highlight=”3″ try=”true”]newTextInput(“poem”, “”) .settings.before( newText(“flowers”, “Violets are blue, roses are red, “) ) .settings.once() .print() .wait() [/js] Adds a one-line input box to the screen preceded with Violets are blue, roses are red, on its left …