Although the response to char response definition is not described in this Guide, there are special considerations when using blocks that contain this response that are noted here. In this situation, you must be careful to ensure that ESL knows when no more information is expected, so that all available responses - including those outside the block - can be taken. In order to check for a pattern match in an outer block, the pattern in the inner block must not be matched. When you are using response to char, the only way to do this is by using a specific pattern match that excludes any other input, that is, using a column specification as shown below.
In the following example, if "y" is not typed, the block will never be left, and no other responses from characters typed from the keyboard can be taken.
response to ExitPrompt
begin
response to char "y" from keyboard # inner
send "y\n" to Application1 # block
leave block
end
interrupt response to char "n" from keyboard # outer
send "n\n" to Application1 # block
In order to make sure that all available responses can be taken, use the col specification in the match clause. In the following example, if the user types any character other than "y" in column 1, the block will be left and ESL is free to take the response to the user typing "n".
response to ExitPrompt
begin
response to char col 1 "y" from keyboard
send "y\n" to Application1
leave block
end
response to char "n" from keyboard
send "n\n" to Application1
response to char from keyboard
append input to StringA