; This option allows the user to construct a custom batch file, using the IDL language.
; The utility is particularly useful when many runs are required in sample environments of 
; varying nature.  The commands are written to the string array "BatchCommands", which is then compiled 
; and executed.  In the example below, the code facilitates the acquisition of twenty short runs as a 
; function of temperature.  The parameters, "tolerance", "maxwait" and "settle" are varied according 
; This option allows the user to construct a custom batch file, using the IDL language.
; The utility is particularly useful when many runs are required in sample environments of 
; varying nature.  The commands are written to the string array "BatchCommands", which is then compiled 
; and executed.  In the example below, the code facilitates the acquisition of twenty short runs as a 
; function of temperature.  The parameters, "tolerance", "maxwait" and "settle" are varied according 
; to the temperature required.   The run will begin to execute after the temperature is within the 
; "tolerance" of the set point for the specified "settletime".  However, the run will execute 
; regardless after the specified "maxwait". These parameters are usually fixed at the default values.
; Note that the number of lines of batch commands that your code generates should not exceed two 
; hundred. 
;
; Note that in IDL the array index begins at 0 not 1.
;
n=0
;
; The batch command and argument may be separated by tabs or spaces.
; The argument must be encompassed by quotation marks.
;
BatchCommands[n] = 'sample	Example'
;
;now increment the index by 1
;
n+=1
;
;The program will search to see if the specified instrument file is valid
;
BatchCommands[n] = 'instrument_file MarsPlannerFile.pln'
n+=1
;
; let us execute 20 runs from 10 to 210 K in 10 degree steps.
; The following is not the most elegant method of achieving the desired result
; but it is the easiest to learn and implement.
;
temperature = 10.0
FOR i = 0, 19 DO BEGIN
	if temperature lt 40.0 then begin
	BatchCommands[n] = 'temperature tolerance 1'
	n+=1
	BatchCommands[n] = 'temperature settle 60'
	n+=1
	BatchCommands[n] = 'temperature maxwait 3600'
	n+=1
	endif
;
	if (temperature ge 40) and (temperature lt 110) then begin
	BatchCommands[n] = 'temperature tolerance 2'
	n+=1
	BatchCommands[n] = 'temperature settle 120'
	n+=1
	BatchCommands[n] = 'temperature maxwait 4200'
	n+=1
	endif
;
	if temperature ge 110.0 then begin
	BatchCommands[n] = 'temperature tolerance 5'
	n+=1
	BatchCommands[n] = 'temperature settle 180'
	n+=1
	BatchCommands[n] = 'temperature maxwait 4200'
 	n+=1
	endif
;
BatchCommands[n] = 'temperature	'+string(temperature)
n+=1
BatchCommands[n] = 'count '+string(50000)
n+=1
BatchCommands[n] = 'wait '+string(360)
n+=1
temperature+=10.0
ENDFOR
;
