A mechanism for incorporating user input modes in a scripting language are provided
for. A context allows use of user input modes in a scripting language in a manner
that corresponds to their use in a GUI. A programming construct, referred to as
a context, specifies at least one user input mode and a state for the user input
mode that are applied to a set of instructions. The operations specified by the
instructions that are referenced by a context are executed as if the user input
modes referred to by the contexts have the state specified by the contexts.