@RLB 101 @RLB 102
@RLB 119 @RLB 120
Saving this command with some name (say, 1to20.spx) and running it by typing
@1to20
processes each of the scans 101 through 120, placing the results in my output file. SPECX will start running 1to20.spx; the first command it gets is to run rlb.spx, and while running rlb it sees the ? and looks for a value, it finds the value in 1to20.spx and continues to run happily along until it gets to the end of 1to20.spx.
This is still a bit silly. Since SPECX allows the use of loops and counters, one can achieve the same result a lot more elegantly. That is, if one creates a command file (call it, say, doit.spx):
do n 101 120 r-g-d\n\ r-l-b\-40 -20\20 40\ wr-sp\1\ enddo
then typing
@doit
will achieve the same result. The counter n will step from 101 to 120.
As you might guess doit.spx could look like this also:
do n 101 120 @rlb\n\ enddo
Taking this still one step further allows the input of parameters from outside:
declare fscan i4 declare lscan i4 ask 'First scan?',fscan,? ask 'Last scan?',lscan,? do n fscan,lscan @rlb\n\ enddo
In this case running this procedure will prompt you for the first and last scans to be processed by rlb.spx. Note that (a) the declaration of the type of variable (I4) required by SPECX for input, and (b) the use of the ask command. The latter gives a prompt (e.g. First scan?) and puts your answer in e.g. the variable fscan.
Specx Cookbook Reduction of millimetre wave data