/* Name: rename.aml /* Function: Rename GRIDs according to certain template /* Author: Maxim Dubinin /* sim@gis-lab.info /* Created 12/20/2006 /* Last Update: 12/20/2006 /* Notes: /****************** THIS AML MUST BE RUN IN ARC/INFO WORKSTATION ***************************** &args sourcedir findstr replacestr /* Usage error handling &if [null %sourcedir%] &then &do &type &type Usage: &r rename {replacestr} &type &ret &end &if [null %findstr%] &then &do &type &type Usage: &r rename {replacestr} &type &ret &end &workspace %sourcedir% &type Workspace set to %sourcedir% /* get a list of all file names to use &do &s inf = covs.lst &if [filelist * covs.lst -grid] < 0 &then &ret Error creating coverage list &end /* Open list file if able &s infile := [open %inf% status -read] &if %status% <> 0 &then &return &warning Error opening file. &setvar current := [read %infile% readstatus] &if %readstatus% <> 0 &then &return &warning Could not read file. /* Select each import file from list, if coverage exists, project it &do &while %readstatus% = 0 &if [exists %current% -grid] &then &do &s output := [subst %current% %findstr% %replacestr%] &s output := [UNQUOTE %output%] &type Renaming %current% to GRID %output% rename %current% %output% /* Read next line. &setvar current := [read %infile% readstatus] &end &end /* Close file. &if [close %infile%] <> 0 &then &type Unable to close %infile%. &if [delete %inf%] <> 0 &then &type Unable to delete %inf%. &return Finished