LoadWave Dialog Suppression
Anne
I have an ongoing problem concerning my data load procedures. The data I want to load usually consists of text files (.txt, .asc, .dat, ...) and is organized similar to the following: date_Number1_Number2_Number3.asc
Number1, Number2 and Number3 are consecutive variables, starting at 1 and extending to any value up to 99 (all series lenghts are different, so no manual number of files can be entered). I am now working on an automated load procedure which loads all consecutive files. My current procedure uses 3 nested Do-while-loops in which the variables are processed. Each loop should be terminated as soon as the last file of the series is loaded, i.e. if _01_01_03.asc exists and _01_01_04.asc doesn't, the loading sould continue at file _01_02_01.asc and so on. At the moment, the loop termination is realized for each variable via the exists-function like the following excerpt:
FileName ="S"+ FileNameS[0,6]+Number+"_"+Number2+"00"+Number3+".asc"
LoadWave/G/D/K=1/O/N=spectrum/P=DataPath FileName
if(exists("spectrum1")==1) //if the second row was loaded successfully and called spectrum1
... //Rename spectrum1 and do all the things i need to do...
else //if nothing was loaded, spectrum1 does not exist
... //reset variables to needed starting values
break //go on with next run
endif
LoadWave/G/D/K=1/O/N=spectrum/P=DataPath FileName
if(exists("spectrum1")==1) //if the second row was loaded successfully and called spectrum1
... //Rename spectrum1 and do all the things i need to do...
else //if nothing was loaded, spectrum1 does not exist
... //reset variables to needed starting values
break //go on with next run
endif
In principle, this works fine except for the problem that for each non-existing file I get the message "The operation could not be completed because the file or folder could not be found. Do you want to help?" which I always have to answer with NO (about 100-200 times a day...). Is there any possibility to suppress this message?
Another, maybe more elegant solution to my problem could be a function like exists to check if a text file exists in a specified folder before trying to load it. In the help files I found no reference of such a function. Does anything like that exist?
Any help is appreciated.
Many thanks!
September 21, 2010 at 11:15 am - Permalink
September 22, 2010 at 01:59 am - Permalink