This article applies to:
E-Prime 3.0
E-Prime 2.0
E-Prime 1.0
Detail
Experiment Author: David McFarlane. Adapted from STEP and used with permission of Brian MacWhinney
Experiment Description
This is a collection of three programs contributed by David McFarlane of Michigan State University. They demonstrate how to decode {key} nomenclature from within multiple-response RESP strings. They are provided along with example .edat files.
Experiment Instructions
E-Prime is oriented toward collecting single-key responses with millisecond timestamps. It represents alphanumeric responses with the normal characters, and represents other characters with its {key} nomenclature, as documented in INFO: {key} naming scheme [35229].
This works well for single-key responses, but may pose difficulty in examining multiple-character responses (e.g., the response "Hey diddle diddle..." would appear as "{SHIFT}Hey{SPACE}diddle{SPACE}diddle{.}{.}{.}"). For cases like this, it might help to have E-Prime decode the string of responses into a normally readable form. Here, three programs are provided to demonstrate how to do that; in each one, the {key} decoding code is provided as a global function (instead of as a simple inline) for improved modularity.
The first example, demoKeyCodeMap(SimpleStringProcessing), uses simple string processing with the Mid$() function. This approach requires the simplest understanding of E-Prime, but is rather clumsy, as it requires custom If/ElseIf clauses, etc., for each mapped key.
The second example, demoKeyCodeMap(MapList&MidFn), puts all the {key} codes in a List that can be easily managed, and transparently extends to handle any specified {key} codes. Users must correctly enter the length of each {key} code into the List (although users with the right skills could have Excel handle that chore). It still uses Mid$() to parse the keystrokes. This example probably makes the best compromise between efficiency and simplicity.
But why write code to parse the keystrokes when E-Prime already does that for us automatically? Yes, E-Prime already puts the fully-parsed train of keystrokes into a Response collection, and the third example, demoKeyCodeMap(MapList&ResponsesColl) takes advantage of that. The resulting program requires no knowledge of the {key} code lengths, simplifying its use. The code also looks clean & compact. But understanding the code requires knowledge of the Responses collection, and use requires knowledge of which input mask was used. Thus, this approach works best for those who like program elegance, but may pose a challenge to less sophisticated users.
Along the way, these example programs also illustrate packaging code into a global function, getting multiple-response input using Max Count and Termination Response, echoing input to the display using an Echo Client, making use of an input mask's Responses collection, and doing a graceful early exit using GetUserBreakState().
Comments
0 comments
Please sign in to leave a comment.