;+ ; NAME: ; ; PURPOSE: ; ; CATEGORY: ; ; CALLING SEQUENCE: ; ; INPUTS: ; ; OPTIONAL INPUTS: ; ; KEYWORD PARAMETERS: ; ; OUTPUTS: ; ; OPTIONAL OUTPUTS: ; ; COMMON BLOCKS: ; ; SIDE EFFECTS: ; ; RESTRICTIONS: ; ; PROCEDURE: ; ; EXAMPLE: ; ; SEE ALSO: ; ; MODIFICATION HISTORY: ; Written by: Your name here, Date. ;- FUNCTION filocate,year,month,day,cam,filt $ ,verbose=verbose,bgs=bgs,ray=ray On_IOError, Bad_Device ; Set up OS-dependent parameters @isitdos ; define file name for desired file testpatt=STRING(year MOD 100,month,day,cam,filt,FORMAT='(3I2.2,2I1,".")') CASE 1 OF KeyWord_Set(bgs): testpatt=testpatt+'bgs' KeyWord_Set(ray): testpatt=testpatt+'ray' ELSE: testpatt=testpatt+'*' ENDCASE ; Check each possible location until a match is found dptr=-1 REPEAT BEGIN dptr=dptr+1 dir=saveroot(dptr)+dd IF KEYWORD_SET(verbose) THEN HELP,dptr,dir,testpatt ; make list of available files of desired type files=rfindfile(dir+testpatt,count=nfiles) files=files(SORT(files)) IF KEYWORD_SET(verbose) THEN HELP,files,nfiles ; Add files found to master list IF nfiles GT 0 THEN BEGIN IF N_Elements(allfiles) EQ 0 $ THEN allfiles=files $ ELSE allfiles=[allfiles,files] ENDIF ENDREP UNTIL (dptr EQ (N_ELEMENTS(saveroot)-1)) nfiles=N_Elements(allfiles) CASE nfiles OF 0: template='' 1: BEGIN PRINT,allfiles(0)+' available; opening file' template=allfiles(0) END ELSE: BEGIN PRINT,'Files available:' FOR i=0,nfiles-1 DO PRINT,i,allfiles(i),FORMAT='(I1,2X,A)' READ,'Select the file to display: ',nd template=allfiles(nd) END ENDCASE Return,template Bad_Device: template='' Return,template END