Pro batch_rnperpixel,dirlist, skipline=skipline

	; NAME:
	;      pro batch_rnperpixel.pro
	;
	; PURPOSE:
	;	This program is a batch procedure for rnperpixel.pro
    ;
	; CALLING SEQUENCE:
	;	batch_darkcurrent,dirlist [,skipline]
	;
	; INPUTS:
	;	dirlist			file name for file containing list of input directories
	;
	; KEYWORD PARAMETERS:
	;	   skipline		number of lines to skip when reading input directory list, defaults to 0
	;
	;
	; EXAMPLE
	;      Run batch_rnperpixel to reduce results from several dark current/read noise experiments. Make PostScript output
	;      batch_rnperpixel, filelist
	;
	; REFERENCE:
	;
	;
	; MODIFICATION HISTORY:
	;       Written by:  E. Morse, IDTL, May 16, 2003
    ;
	;-

	; Set directory string according to handle UNIX and Windows

	if (!version.os_family eq 'unix') then begin
		slashstring='/'
	endif else begin
        slashstring='\'
    endelse

    ; Set default file list
	if (not (keyword_set(dirlist))) then dirlist='batch_darkcurrent_dirlist.txt'

    ; Set defaults
    if (not keyword_set(outps)) then outps = 0  			; Default does not write PostScript
    if (not keyword_set(skipline)) then skipline=0

	; read in list of directories
	  readcol, dirlist, filenames, testdirs, plotdirs, x1,x2,y1,y2, saref, maref, rt, format='(A,A,A,I,I,I,I,I,I,D)', $
	           skipline=skipline

	; process data in each directory
	for i=0,n_elements(testdirs)-1 do begin
		; add a slash to the directory names if the last character is not one.
		if (strlen(testdirs(i)) ne strpos(testdirs(i),slashstring,/reverse_search)+1) then testdirs(i)=testdirs(i)+slashstring

		print,'Processing data in directory '+testdirs(i)

		;call rnperpixel--the directory list also contains the input parameters to use
		rnperpixel, testdirs[i], infile=filenames[i], outfile='stdfiles.txt', region=[x1[i],x2[i],y1[i],y2[i]]

	endfor

End