file, directory, or volume name is incorrect
kbrowne
Here's a simplified version of the code:
Function openFiles()
Variable refNum
Open /D /R /MULT=1 /M="Select one or more files" refNum
String outputPaths
outputPaths = S_fileName
print outputPaths // prints C:Users:Kevin:Documents:igor coding:dataset1.txt
Open /R refNum as outputPaths
End
Variable refNum
Open /D /R /MULT=1 /M="Select one or more files" refNum
String outputPaths
outputPaths = S_fileName
print outputPaths // prints C:Users:Kevin:Documents:igor coding:dataset1.txt
Open /R refNum as outputPaths
End
When I run that, I get: "While executing Open, the following error occurred: The file, directory, or volume name is incorrect."
However, when I replace
Open /R refNum as outputPaths
with
Open /R refNum as "C:Users:Kevin:Documents:igor coding:dataset1.txt"
then everything works fine. This confuses me, because outputPaths is a string, and is the exact same string that I hard coded in the second example there. Why isn't this working when I put the string variable in there? I'm sure it's obvious, but I can't seem to figure that out right now! Thanks very much for the help.
Kevin
If you are dealing with just one file, remove the /MULT=1.
If you need to handle multiple files then you need to extract them from the CR-delimited list using StringFromList with CR ("\r") as the listSepStr parameter.
November 12, 2014 at 10:13 pm - Permalink
Kevin
November 12, 2014 at 10:34 pm - Permalink