
symbolic paths and opening files

minghaoj
Here is the Macro I wrote. It calls loadtrace on all files in folder called pathname, then load and process all files in a given folder.
However, when I type the command for example loadODMRtraces("C:\Users\BurkeLab\Desktop\070824"), it gives me an error saying that no symbolic path of that name. How could I fix this bug. Thanks!
Macro loadODMRtraces(pathname) // calls loadtrace on all files in folder called pathname // Load and process all files in a given folder. // The folder is specified by pathName which becomes a dialog // if no input is given. // YOU MUST INCLUDE #include <Strings as Lists> // SOMEWHERE IN YOUR PROCEDURE, AS THIS MACRO // CALLS SUBROUTINES FROM THAT INCLUDE FILE. String pathName // name of symbolic path or "" to get dialog variable/d numfiles String filename PauseUpdate; Silent 1 // Processing files . . . Variable index=0 variable/d tracenum if (strlen(pathName)==0) // if no path specified, create one NewPath/O temporaryPath // this will put up a dialog pathName = "temporaryPath" endif print IndexedFile($pathName,-1,"????") do fileName = IndexedFile($pathName, index, ".csv") if (strlen(fileName)==0) break // break out of loop endif // Assume file name is of form mmddyyc.xxxx, where x is a number. Strip off the number. tracenum = str2num(filename[7,10]) loadODMRtrace(tracenum,filename,pathname) print index,filename,tracenum index += 1 while(1) if (Exists("temporaryPath")) // kill temp path if it exists KillPath temporaryPath endif EndMacro
You are confusing symbolic path names with file path values.
Enter this command for a more thorough explanation that I can give here:
DisplayHelpTopic "Symbolic Paths"
August 19, 2024 at 04:40 pm - Permalink
Also, this comment:
Is relevant to only a very ancient version of Igor, and hasn't been needed since Igor 3 or so.
Now, maybe loadODMRtrace() does rely on that ancient Strings as Lists procedure file; it should be updated to use the built-in functions such as StringFromList() and ItemsInList(), etc.
August 19, 2024 at 04:43 pm - Permalink