Script examples

The following are examples of window scripts. If you want, you can type these examples into a script file and then run Proto or Composer to see what the windows look like.

The following example defines a menu column with the name “Utilities” on the menu bar. The internal name is util. It contains three entries and defines a shortcut for each.

.column util, "Utilities"
.entry abort, Abort, key(^A)
.entry exit, "Exit function", key(F4)
.entry o_help, Help, key(Help)

The next example defines an input window with the title “Address Book.” It contains seven fields, which are painted with the dot character to indicate where the user types input. The border is in reverse video. The first field, lastnm, is required—the user can’t skip it. Input to the state field is displayed in uppercase.

The phone field is left blank if the user enters a value of 0; input is redisplayed in the format (XXX) XXX‑XXXX.

.input address, 14, 60
.place 2, 10
.border reverse
.title " Address Book "
.paint '.'
.field lastnm, a15, required, position(2,2), prompt("Last name  ")
.field firstnm, a15, position(3,2), prompt("First name  ")
.field addr, a30, position(4,2), prompt("Address  ")
.field city, a20, position(5,2), prompt("City  ")
.field state, a2, uc, position(5,35), prompt("State  ")
.field zip, d5, position(5,45), prompt("Zip code  ")
.field phone, d10, fmt("(XXX) XXX-XXXX"), position(6,2), bzro, –
    prompt("Phone  ")

The following example defines a selection window called prod that has four entries, whose quick‑select characters are F, R, S, and U. The entries in the window are “Full System,” “Runtime(s),” “Support,” and “Update,” respectively.

.select prod, 5, 13
.item "Full System"
.item "Runtime(s)"
.item "Support"
.item "Update"