Application icon

Delaying & Repeating Escape Processing

At times it might be desirable to pass around a string containing escape sequences which will be expanded later. Use of the \L and \2 escape sequences can accomplish this. \L stops processing all escape sequence processing following the \L sequence. A \2 sequence found in a string being escaped, causes the escaping to be repeated a second time.

As an example, let's say that you have an inline action which processes errors and displays an error message depending on where the error occurred. Assume the generic error handler is an inline action named Process Error as follows:

Start Process Error
' ... Statements to process the error
Prompt \2\<Error Message>

The inline action performs error processing and then displays a prompt. The prompt is in named variable Error Message and contains unevaluated escape sequences. The presense of \2 in the prompt causes the text of the resultant string to have escape processing repeated. Any escape sequences in Error Message will only be evaluated when the Prompt is issued.

Let's say you are testing an arbitrary field to see if it is empty. The name of the field is in a named variable field. The error message could be issued as:

Set named variable 'Error Message' to "\LField: '\<field>' is empty"
Run inline action 'Process Error'

The \L sequence stops character unescaping so the Error Message named variable will be set to Field: '\<field>' is empty. When the escaping is repeated by the \2 option in the Process Error action, the name variable field will be expanded.

Assume a second error to be raised is the content of the field referenced by field is longer than a value in a max named variable where the value in max depends on the field.

Set named variable 'Error Message' to "\LField '\<field>' is longer than \<max>"
Run inline action 'Process Error'

The \L sequence stops character unescaping so the Error Message named variable will be set to Field: '\<field>' is longer than \<max>. When the escaping is repeated by the \2 option in the Process Error action, the name variables field and max will be expanded.