Monday 8 June 2015

Special keys in E-Prime

E-Prime allows to use so-called special keys to define allowable and correct responses in E-Objects. Did you know that you can use almost all keys on your keyboard? Information about special keys is quite difficult to find, because it is hidden in E-Prime's help file. We hope that publishing this blog will help to find it quickly on the internet too.

If you look for {KEY} in the E-Basic Help (not to be confused with the E-Studio help, see the Help menu) you will get an overview of all possible keys. Please find a copy of this {KEY} entry below.


E-Prime provides a nomenclature for defining special keys as the allowable and correct input. Just as the attribute reference nomenclature uses brackets wrapped around a value (such as [CorrectAnswer]) to inform E-Studio that the value represents an attribute reference to be looked up in the context, the {KEY} nomenclature uses the curly braces (the { and } characters) to signify a special input. The {KEY} nomenclature may identify an individual key (for example, the Shift key) or a group of keys or inputs (for example, all of the numeric keys) . Some of the input specified with the {KEY} nomenclature are specific to an individual device while a few are shared amongst all devices.


Some of the {KEY} settings are used to specify an individual key or input. For example, {SPACE} specifies the space bar. Keys that do not have an easy to read or printable ASCII equivalent, such as function keys, are specified using the {KEY} nomenclature as well. (e.g., {F1}).


Some of the {KEY} settings are used to specify a group or range of inputs. For example, specifying {ALPHA} lets E-Prime know that all alphabetic keys should be used, while specifying {NUMBER} lets E-Prime know that only 0-9 should be used. Groups may be only be specified as allowable input; correct input must be specified as an Individual key or input.


E-Prime recognizes {ANY} to mean any press that the device supports. (The curly braces are required to differentiate any press supported by the device from the individual keys "a", "n", and "y", which is specified as "any") All input mask objects support the {ANY} grouping.


E-Prime provides the ability to have an input mask look for presses, releases, or both presses and releases. By default, each device is configured to handle processing of input presses. Enabling a device to handle releases requires a change to the CollectionMode and a modification of the {KEY} nomenclature. First, you can change the CollectionMode property to handle presses, releases or both by editing the Experiment object. Second, to specify a release in an input mask via the Duration/Input property page, add a "-" character after the opening curly brace. For example, if you wanted the input to be accepted when the user presses the space bar, you would specify {SPACE}. However, if you want the release of the space bar, you would specify {-SPACE}. For alphanumeric characters not requiring the {KEY} nomenclature, specify the actual key to accept a key press (e.g., 1 and not {1}), but use the curly braces and negative sign to accept a key release (e.g. {-1}).


When a special key is processed, it is added to the RESP property of the object in its {KEY} nomenclature. For example, if the end user typed "c a t", the RESP property value would be "c{SPACE}a{SPACE}t".

Device Specific

Each device supports its own use of the {KEY} nomenclature. Most devices do not have many entries. The exception is the keyboard for the obvious reason that it has so many possible entries. The tables (original images are now in text format, thanks to and a bit of manual edits) below show the available entries for each object that supports accepting responses*.

Keyboard (group)

{ANY}, {-ANY}

Keyboard (individual)

the numbers 0 through 9 
the numbers {-0} through {-9} 
the letters A through W, a through w 
the letters {-A} through {-Z}, a through any of the following 




Keyboard (individual)


Mouse (group)

{ANY}, {-ANY}

Mouse (individual)

the numbers 1 through 8
the numbers {-1} through {-8}
the letters A through W
the letters {-A} through {-W}

Port (group)

{ANY}, {-ANY}
the numbers 0 through 9
the numbers {-0} through {-9}
the letters A through W 
the letters {-A} through {-W}

SRBox (group)

{ANY}, {-ANY}

SRBox (individual)

the numbers 0 through 9
the numbers {-0} through {-9}
{ANY}, {-ANY}

* The {KEY} mappings for Group are only permitted in the Allowable property. The {KEY} mappings for Individual are permitted in either the Allowable or Correct property.


  1. This comment has been removed by a blog administrator.

  2. So excited to purchase the book, but I'm trying to create a Cyberball for use with ERP's and keep getting the error "left to "." must be an object, structure, or dialog"

    This is from the code provided on page 133:

    PlayerMovieDisplay1.FileName = "1to" & c.GetAttrib ("TargetPlayer") & ".wmv"

  3. Thanks for your question. It is likely that your MovieDisplay object in the procedure has another name and that might be the reason why E-Prime does not recognize PlayerMovieDisplay1 as a MovieDisplay object. Hope that helps.

  4. I'm trying to permit input using an ECHO which can take umlauts. Any suggestions?

  5. How can I make a correct response space bar single click and space bar double click?

  6. how to make a "no press" (not pressing any key) as allowable.

    1. Allowable keys are the ones that are being captured by an e-object (e.g. textdisplay), so NOT setting a key to be captured just means leaving that key to be ignored. Logically, that means if someone does NOT press the key, it will NOT be recorded, but I don't see why you are concerned with behaviour that doesn't occur.

      I suspect, though, what you mean is 'how to make a non-press as an OK response', which is by not defining it as a 'correct' response. That is, if allowable 'a' and correct is left empty, any a press will be scored as inaccurate and no button as accurate. Obviously, you will have to define a time limit for this to work, as nobody will press a button within 10 ms, and an infinite duration requires a button press to be ended, so will always have one (similarly, your 'RT' of the lack of button press will always be 0).