Symbolic path already exists
Olav Kiam
The script I am trying to write needs to open all txt files from a folder, load the waves, and calculate some things. It works fine, however, for every file Igor asks me me the following: "The symbolic path datadir already exists. Do you want to change it?" Yes / No.
Since there will be many files, i would rather not be asked this question. Even more because it doesn't seem to matter whether I click yes or no.
Can I prevent this question from popping op every time?
Regards,
Olav
Function processfiles(folder)
String folder
NewPath/Q datadir, folder
String fileName
Variable index = 0
do fileName = IndexedFile(datadir, index, ".txt")
if(strlen(fileName) == 0)
break
endif
loadcsf(folder, fileName)
// here I work on the waves
end
//########################
Function loadcsf(fromthisfolder, thisFile)
String fromthisfolder
String thisFile
NewPath/Q datapath, fromthisfolder
String columnInfoString = ""
columninfostring + = "N='Time1'; 'N=Current1'; 'N='Voltage1';"
loadWave/J /A B=columninfostring /P=datapath /Q thisFile
end
String folder
NewPath/Q datadir, folder
String fileName
Variable index = 0
do fileName = IndexedFile(datadir, index, ".txt")
if(strlen(fileName) == 0)
break
endif
loadcsf(folder, fileName)
// here I work on the waves
end
//########################
Function loadcsf(fromthisfolder, thisFile)
String fromthisfolder
String thisFile
NewPath/Q datapath, fromthisfolder
String columnInfoString = ""
columninfostring + = "N='Time1'; 'N=Current1'; 'N='Voltage1';"
loadWave/J /A B=columninfostring /P=datapath /Q thisFile
end
NewPath
with the /O flag, which will cause a symbolic path of the same name to be overwritten (if it exists).In general, if certain Igor operations or commands give you an error message (or similar), be sure to check the command help in the manual. Many operations have flags such as /Q, /O/ and /Z that can suppress errors, overwrite, or suppress printing of output to the command line.
October 28, 2008 at 08:06 am - Permalink