next up previous
Next: Specific WILDFIRE Commands Up: The WILDFIRE Software System Previous: The 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 /ua20/cirim/scripts/<scriptname>.tcl

To execute the script, enter the basename <scriptname> as a command in the Instrument Control window. do_standard and do_grid are useful tcl scripts that allow you to take either a 3 tex2html_wrap_inline534 3 grid of data or an arbitrary rectangular grid of data respectively. Some useful scripts (either for use or modification) may be found in the /usr/wfire/elston subdirectory on ctioa1 or ctioa2. Many examples of tcl scripts which you can customize, may be found in /ua20/cirim/scripts/ and /usr/wfire/tcl/CIRIM.

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 insturment 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 k
     delay 10
     title "A 10 second K band image"
     go
     filter j
     delay 20
     title "A 20 seconds J band image"
     go
     filter 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 Editor

robert blum x297
Tue Nov 25 15:03:21 CDT 1997