Home | Contents | Index | Help | < Browse | Browse >

 Other variables:
 -------------------------------------------------------------------------

 Local variables/constants:

 [THIS] is the name of current loaded script file. If you want to reload
        the script, you can for examle have this button:
        'BUTTON Reload load "[this]"'
 
 [PID]  is the process id (or shell number). With this, you can create
        unique env variable names like this:
        
        exec 'setenv datum[pid] `date`'
        text "[datum[pid]]"
        unsetenv datum[pid]
 
 [VER]  is the version of selector.

 -------------------------------------------------------------------------

 Arguments

 [arg1] [arg2] .... [arg9] is the optional arguments passed to
 selector from the command line. (Selector <script> [<arg1> ... <arg9>])
 Or with the Button..load command:
 (button ButtName load <script> [<arg1> ... <arg9>])

 When you pass arguments to Selector, they are treated as normal
 Selector strings, for example:

 A script called arg.sel:

   text '[arg1]'
   text '[arg2]'
   text '[arg3]'

 Run it like this:

 Selector arg.sel 'This is arg 1' "This is arg 2" 'This is "arg 3"'


 Default arguments

 You can use the DefArg command to specify a default
 value for an arg variable. This default value will be used if the
 argument wasn't passed from the command line (or button..load command):

 Example: (script called "argtest.sel")

    defarg arg1 "First arg not given"
    defarg arg2 "Second arg not given"
    text '[arg1]'
    text '[arg2]'

 Try it like this:

    1 selector argtest.sel Passing arguments
    2 selector argtest.sel
    3 selector argtest.sel * *
    4 selector argtest.sel * 'Only second arg given'
    5 selector argtest.sel 'Only first arg given' *
    6 selector argtest.sel 'Here to'

 As you can see, passing "*" will give the default string. You must use
 the "*" if you only want to pass the second argument (like in
 case 4 above).

 -------------------------------------------------------------------------

 About arguments without default value

 If you don't have a default value for an argument that not is passed, then
 an empty string will be used.

 Example: (script called "argtest2.sel")

    text '[arg1]'
    text '[arg2]'

 Try it like this:

    selector argtest2 Hello!

 -------------------------------------------------------------------------

 Also see the use of selector in shell scripts.

Home | Contents | Index | Help | < Browse | Browse >