Dialog Boxes
A number of functions are available which provide means of obtaining user input
through dialog boxes. These are:
The above are the general purpose user interface functions. In particular, the function
NewValueDialog is very universal in nature and has a wide range of
applications. There are many more specialised functions. These are listed in
Functions by Application.
User Control of Execution
Sometimes it is desirable to have a script free run with actions controlled by a key or
menu item. For example you may require the user to select an arbitrary number of
nodes on a schematic and then press a key to continue operation of the script to
perform - say - some calculations with those nodes. You can use the
DefKey and
DefMenu commands to do this. However, for a key or menu to function while a script
is executing, you must specify "immediate" mode when defining it. Only a few
commands may be used in "immediate" mode definitions. To control script execution,
the
Let command may be used. The procedure is to have the key or menu
assign a global variable a particular value which the script can test. The following
example outputs messages if F2 or F3 is pressed, and aborts if F4 is pressed:
defkey F2 "scriptresume;let global:test=1" 5
defkey F3 "scriptresume;let global:test=2" 5
defkey F4 "scriptresume;let global:test=0" 5
let global:test = -1
while 1
scriptpause
if global:test=0 then
exit script
elseif global:test=1 then
echo F2 pressed
elseif global:test=2 then
echo F3 pressed
endif
let global:test = -1
endwhile
unlet global:test