DMDX Help.

Prose Keyword

<Prose a, b, c, d>

    Switch to facilitate typed prose, also a clock on specifier.  <Prose> is used in combination with branching, macros and either <ProgressiveX> or <Instruction> to gather typed text from the console.  <Prose> is quite superior to either <ZillionTypedResponses> or purely macro based typing as <Prose> uses Windows messages to assemble the typed text and thus knows about case and auto-repeat, neither of which is accessible with other methods.  <Prose> accepts the names of four macros, the first two of which contain the typed character information (characters before the cursor and characters after the cursor) and two of which the user uses to display the typed text as they contain marked up versions of the text suitable for use in an item.  The only keys that need to be mapped are the ones that terminate the prose typing session, all other keys are transparent as the Windows messages used to generate the typed prose are not passed through the regular DMDX input processing system (they couldn't be because there's no way ahead of time to enumerate all possible keys, a feature central to DMDX's input processing).   Instead when a Windows message comes in that affects the prose (either printable characters or editing commands) the prose handler signals that the response has been timed out and the item should branch unconditionally back to itself to display the changed prose.  Only select keys are used, excluded keys include {, } and \ (because they're reserved for the RTF syntax) and of course ; and " that are sacrosanct DMDX item delimiters.

    Requires a rather specific item file, for example this item file records a page of typed prose:

f1 <vm desktop> <id keyboard> <nfb> <cr>


~3 ma++ mb++ mc++ md++ <mpr +F12> <dfm .75>;


+1 <delay 2>  <inst .1,.1,.8> "Please ", "type ", "some ", "prose ", "and ", "press ", "F12 ", "when ", "done." <inst nl>, <inst nl>, ~c, "|", ~d <prose a,b,c,d> <mwb +F12,2 bu,-1> ;


2 <emit typed text is:~a~b:> "Done";

    Almost all elements of that item file are essential, feedback must be disabled, it must continuously run, the macros must be set empty before each use of <Prose> (otherwise (a) on first use there would be messages about uninitialized macros being used and (b) because on repeated use there's no way the prose logic can set them up before the item has been parsed when the macros expand), F12 (or other similar keys) has (have) to be used to end typing because using the Enter key is part of typing prose and <delay 2> is needed otherwise the display will lag behind the typing.  Note that item 1 has a + correct response indicator because <prose> is a clock on keyword.

    Here I'm using a vertical bar as a cursor (one can use the arrow keys to move around the text), you could in fact put any character you liked between the ~c and ~d frames.  In fact one thing I experimented with was having the cursor flash by making the timeout 500 milliseconds or so and having a duplicate <prose> item following with only a space between the ~c and ~d frames however a space isn't the same width as a vertical bar and having the text move a few pixels with the cursor flashing was weird.  However if you did find a character the same width as a space it would work pretty well (you also have to remove the bu -1 from the first <prose> item).

    The following example instead of gathering a page of prose gathers a single line of it instead (probably more useful for remote testing, example is here):

f1 <vm desktop> <id keyboard> <nfb> <cr>


~3 ma++ mb++ mc++ md++ <mpr +enter> <dfm .75>;


+1 <delay 2>  @-2 <x .1> "Please type some prose and press enter when done." ,

            <px .1> ~c, "|", ~d <prose a,b,c,d> <mwb +enter,2 bu,-1> ;


2 <emit typed text is:~a~b:> "Done";

    Here even though <Prose> is marking up the text as if it was to be displayed by in an instruction item our use of <ProgressiveX> gets around that and the fact that other keys (like Enter) will cause <inst> specific flags to be set is inconsequential if <inst> itself hasn't been used.

    Note that if you are going to input multiple sections of prose you have to clear the macros between usages:

f1 <vm desktop> <id keyboard> <nfb> <cr>


~3 ma++ mb++ mc++ md++ <mpr +enter> <dfm .75>;

 +101 <delay 2>  @-2 <x .1> "Please type some prose and press enter when done." ,

            <px .1> ~c, "|", ~d <prose a,b,c,d> <mwb +enter,102 bu,-101> ;

 102 <emit typed text is:~a~b:> "Done";


~3 ma++ mb++ mc++ md++;

 +111 <delay 2>  @-2 <x .1> "Please type some more prose and press enter when done." ,

            <px .1> ~c, "|", ~d <prose a,b,c,d> <mwb +enter,112 bu,-111> ;

 112 <emit typed text is:~a~b:> "Done";

    When using <prose> with right to left fonts and <inst right2left> it is necessary to include at least one character before the macros in the right to left font you wish to have the typing rendered in.  While this is true to use any font other than the default one DMDX happens to be using it's more critical for these fonts:

f1 <vm desktop> <id keyboard> <nfb> <cr>

0 ma++ mb++ mc++ md++ <mpr +enter> <dfm 1.5 > "Hebrew typing test";

+1 <delay 2> <inst right2left> <inst .2, .4, .9> <xyjustification 4> "אנא הקלד עוד ועוד כאן." ,

~c, "|", ~d <prose a,b,c,d> <mwb +enter, 2 bu,-1> ;

2 <emit typed text is"~a~b">"סוף";


DMDX Index.