User Interface to Scripts

In this Topic Hide

Dialog Boxes

A number of functions are available which provide means of obtaining user input through dialog boxes. These are:

Function name Comment
AddRemoveDialog Add or remove items to or from a list
BoolSelect Up to 6 check boxes
ChooseDir Select a directory
EditObjectPropertiesDialog Read/Edit a list of property names and values
EditSelect Up to 6 edit boxes
EnterTextDialog Enter multi line text
GetSimetrixFile Get file name of pre-defined type
GetUserFile Get file name (general purpose)
InputGraph Input text for graph
InputSchem Input text for schematic
NewValueDialog General purpose dialog box
RadioSelect Up to 6 radio buttons
SelectDialog Select item(s) from a list
TableDialog Present items in a table
TableEditor Present lists of items in a table
TreeListDialog Select item from tree structured list
UpDownDialog Re order items
UserParametersDialog Read/Edit a list of parameter names and values
ValueDialog Up to 10 edit boxes for entering values

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