pro WGETUSER, wd, user1d, user2d, nf1, nf2 ;+ ; NAME: ; WGETUSER ; ; PURPOSE: ;This procedure goes to the two folders within the WWB folder that may or ;may not contain user-defined data and returns two string arrays that ;contain the titles of the files. The two folders that this function ;checks are: 'u1ddata' and 'u2ddata'. If file(s) are in ;'u1ddata'/'u2ddata', then the user1d/user2D string array returns ;strings that precede the '.doc' filenames. ; ; CATEGORY: ; Wavelets ; ; CALLING SEQUENCE: ; WGETUSER, wd, user1d, user2d, nf1, nf2 ; ; INPUTS: ; wd = working directory (string) ; ; OUTPUTS: ; user1d = string array containing user-defined titles ; of the 1d files ; user2d = string array containing user-defined titles ; of the 2d files. ; nf1 = number of 1D user-defined files ; nf2 = number of 2D user-defined files ; ; ; EXAMPLE: ; ; ; MODIFICATION HISTORY: ; Written by: Amara Graps September, 1995 ; Updated by Amara Graps March 1996 to handle VMS paths/filenames ;- CD, wd ;change user to working directory ;----------------------- ;Check one-d directory ;----------------------- CD, 'u1ddata' flist=FINDFILE('*.doc') nf1 = N_ELEMENTS(flist) ;If nf1 = 0, then don't do anymore for 1D User Data, ;otherwise pull out the identifying title CASE nf1 of 0: user1d = '' ELSE: BEGIN ;NOTE: in VMS, findfile returns the full pathname ;Handle special case for VMS tos = STRUPCASE(STRTRIM(!version.os,2)) CASE tos OF 'VMS': BEGIN FOR i = 0, n_elements(flist)-1 DO BEGIN slen = STRLEN(flist(i)) ;Find location of right bracket "]" to extract the file ;name from something like: ;'$DISK3:[AGRAPS.WWB.U1DDATA]TWEET.DOC;1' bracket = STRPOS(flist(i),']',0) temp = STRMID(flist(i), bracket+1, slen-bracket) ;We also want to get rid of the ";*" at the end ;(e.g. from TWEET.DOC;1) colon = STRPOS(temp,';',0) slen = STRLEN(temp) temp2 = STRMID(temp, 0, colon) ;Now we just have "TWEET.DOC" ;reset the flist variable flist(i) = temp2 END ;For i END ;Case VMS ELSE: ;not VMS ENDCASE ;Strip out the identifying 'title' for each file name.. ;'foobar.doc' becomes 'foobar' titlelist = STRARR(nf1) FOR k = 0, nf1-1 DO BEGIN slen = STRLEN(flist(k)) titlelist(k) = STRMID(flist(k), 0, slen-4) ;(because VMS makes upper case) titlelist(k) = strlowcase(titlelist(k)) END ;FOR k user1d = titlelist END ;ELSE ENDCASE CD, wd ;change back to working directory ;----------------------- ;Check two-d directory ;----------------------- CD, 'u2ddata' flist=FINDFILE('*.doc') nf2 = N_ELEMENTS(flist) ;If nf2 = 0, then don't do anymore for 2D User Data, ;otherwise pull out the identifying title CASE nf2 of 0: user2d = '' ELSE: BEGIN ;NOTE: in VMS, findfile returns the full pathname ;Handle special case for VMS tos = STRUPCASE(STRTRIM(!version.os,2)) CASE tos OF 'VMS': BEGIN FOR i = 0, n_elements(flist)-1 DO BEGIN slen = STRLEN(flist(i)) ;Find location of right bracket "]" to extract the file ;name from something like: ;'$DISK3:[AGRAPS.WWB.U2DDATA]PHONE.DOC;1' bracket = STRPOS(flist(i),']',0) temp = STRMID(flist(i), bracket+1, slen-bracket) ;We also want to get rid of the ";*" at the end ;(e.g. from PHONE.DOC;1) colon = STRPOS(temp,';',0) slen = STRLEN(temp) temp2 = STRMID(temp, 0, colon) ;Now we just have "PHONE.DOC" ;reset the flist variable flist(i) = temp2 END ;For i END ;Case VMS ELSE: ;not VMS ENDCASE ;Strip out the identifying 'title' for each file name.. ;'foobar.doc' becomes 'foobar' titlelist = STRARR(nf2) FOR k = 0, nf2-1 DO BEGIN slen = STRLEN(flist(k)) titlelist(k) = STRMID(flist(k), 0, slen-4) ;(because VMS makes upper case) titlelist(k) = strlowcase(titlelist(k)) END ;FOR k user2d = titlelist END ;ELSE ENDCASE CD, wd ;change back to working directory END ;of function WGETUSER ;************************************************************