next up previous
Next: Specific WILDFIRE Commands Up: The WILDFIRE Software System Previous: The Command Line Editor

Scripts

Scripts are a powerful tool for executing a sequence of tcl commands, including telescope motions, instrument motor commands, and observations, as a single executable program. Even for those who are not veteran programmers (most of us), simple scripts are fairly easy to construct. The best recipe for starting out is to copy an existing script to a new file, then edit that file as desired. The first line of the script file contains the basename of the script file (``proc <scriptname>''), and must be edited to reflect the new name of a script created in this manner. Before the initial use of a script (or after a system restart), it must be identified as an executable in the Instrument Control window, using the full path name of the file; e.g.,

source /usr/wfire/elston/<scriptname>.tcl

or

source /ua10/irs/scripts/<scriptname>.tcl

To execute the script, enter the basename <scriptname> as a command in the Instrument Control window. abba and nsscan are useful tcl scripts that allow you to take either take abba pairs of data or scan a star along a north-south slit. Some useful scripts (either for use or modification) may be found in the /usr/wfire/elston subdirectory on ctioa1 or ctioa2. More complex examples can be found in /ua10/irs/scripts/ and /usr/wfire/tcl/IRS. Note that these scripts are subject to modification. Do not attempt to use them without checking that they do what you want.

While a full discription of TCL is beyond this manual we will give a few examples to guide you in writing your own TCL scripts. Each script should be in a file which is the name of the script plus a ``.tcl'' extension. The first line of any TCL script must be a ``proc'' statement followed by the name of the script which must be identical to the name of the script. Next is a pair of curly braces which contain any varibles which are to be passed to the script. This is followed by a single curly brace which begins the script. The script is ended by another single curly brance. For example a simple script called ``junk.cl'' which only prints a message would be:

proc junk {} {
     puts stdout "This prints a junk message"
}

Within a script you can include any command you would type into the instrument control window (i.e. offset, go, filter etc....). Thus a script to take 3 exposure of a source in the J,H and K filters could be:

proc junk {} {
     filter to k
     delay 10
     title "A 10 second K band image"
     go
     filter to j
     delay 20
     title "A 20 seconds J band image"
     go
     filter to h
     delay 15
     title "A 15 second H band image"
     go
}

You take make more complex contructions using loops. A simple loop would be:

     set i 1
     while { $i <= 10} {
          puts stdout "This prints the same message 10 time"
          incr i
     }


next up previous
Next: Specific WILDFIRE Commands Up: The WILDFIRE Software System Previous: The Command Line Editor
robert blum x297
1998-04-25