User Commands

An application command operates as shorthand for a more complex command. An application command can be created by:

set appcmd <name> <text> [<token=value>*]

where the <text> portion is issued as a command in response to the entry of the <name>. For example, to say "hello, world" when the user types "bigbang":

set appcmd bigbang 'say hello, world'
Enter command:>bigbang
hello, world

Note the quotes surrounding the command. This is required.

Appcmds are global to the server, and can be created in the startup script. Once created, they can be accessed from the main command window (if any) or from a Telnet command console.

Parameters can be included as token=value pairs. The value is included in the executed command within $name$ brackets.

set appcmd bigbang  'say hello, $where$'

To execute the command, enter the following:

Enter command:>bigbang where=mars
hello, mars

You can also add a default value, by including token=value pairs on the definition line:

set appcmd bigbang  'say hello, $where$'  where=world
     
Enter command:>bigbang where=mars
hello, mars
Enter command:>bigbang
hello, world

For example:

  1. An application keeps counters for items read and items successfully indexed into a data base. The counters are in metric registers myapp.read and myapp.index. A command is desired to report the current counters.
    set appcmd myapp "say read: _sreg(myapp.read,0), indexed _sreg(myapp.indexed,0)"
    Enter command >myapp
    read: 15, indexed: 13
  2. A user wants to encrypt passwords in AES, under the key stored in the pre-defined special register aeskey. The password needs to be surrounded in recognition tags, and it will be stored in the properties file pswds.properties. The command is shown on two lines in the example, but it must be on a single, continuous line.
    set appcmd enc  "set property c:/pswds $pswd$
     _concat('aes(',_aes('enc',sreg(aeskey),$pswd$),')')"
    Enter command:>enc pswd=dick
    The password properties file now contains the first entry
    #Saved by set command
    #Wed Jun 02 16:15:20 EDT 2010
    dick=aes(gM7ghnyG4DkLaJrs6R/jhQ\=\=)

iWay Software