batch file loader causing igor to crash
sleepingawake86
Function LoadAllFilesFromFolder(pathName)
String pathName // Name of an Igor symbolic path or "" to get a dialog
if (strlen(pathName) == 0)
NewPath/O/M="Choose a folder containing TIFFs" LoadIndexedFilePath
if (V_flag != 0)
return -1 // User cancelled
endif
pathName = "LoadIndexedFilePath"
endif
String fileName
Variable index
index = 0
do
fileName = IndexedFile($pathName, index, "TEXT")
if (strlen(fileName) == 0)
break // No more files.
endif
LoadWave /J/M /P=$pathName fileName
index += 1
while (1)
End
<pre><code class="language-igor">
String pathName // Name of an Igor symbolic path or "" to get a dialog
if (strlen(pathName) == 0)
NewPath/O/M="Choose a folder containing TIFFs" LoadIndexedFilePath
if (V_flag != 0)
return -1 // User cancelled
endif
pathName = "LoadIndexedFilePath"
endif
String fileName
Variable index
index = 0
do
fileName = IndexedFile($pathName, index, "TEXT")
if (strlen(fileName) == 0)
break // No more files.
endif
LoadWave /J/M /P=$pathName fileName
index += 1
while (1)
End
<pre><code class="language-igor">
One data file should be sufficient - we can duplicate it 10 times here. But verify that the crash occurs if you duplicate that data file 10 times and run your procedure before sending it as we need to reproduce the problem in order to fix it.
October 1, 2011 at 06:44 am - Permalink
October 1, 2011 at 12:26 pm - Permalink
so no files were loaded.
I changed the file name from "0" to "Data0.txt" and duplicated the file 9 times creating "Data1.txt", "Data2.txt" and so on.
I also changed "TEXT" in the procedure to ".txt" to make sure it found the .txt files.
I also added this to the loop so I could see what is going on:
I then executed LoadAllFilesFromFolder(""), chose the folder containing the files, and all of the files were loaded.
I got no hang or crash.
In order to further investigate I need step-by-step instructions for creating the problem.
I'm running Igor Pro 6.22A on Mac OS X 10.6.3.
October 1, 2011 at 03:02 pm - Permalink
October 2, 2011 at 03:12 pm - Permalink
Perhaps your problem is caused by other files in the folder other than the data files. Try removing all other files.
Here is code that will load all files with no extension and will skip files with an extension. Make sure that all files in the folder with no extension are in fact data files.
String pathName // Name of an Igor symbolic path or "" to get a dialog
if (strlen(pathName) == 0)
NewPath/O/M="Choose a folder containing data files" LoadIndexedFilePath
if (V_flag != 0)
return -1 // User cancelled
endif
pathName = "LoadIndexedFilePath"
endif
String fileName
Variable index
index = 0
do
fileName = IndexedFile($pathName, index, "????") // All files
if (strlen(fileName) == 0)
break // No more files.
endif
String extension = ParseFilePath(4, fileName, ":", 0, 0)
if (strlen(extension) == 0) // Load only if file has no extension
Print index, fileName
LoadWave /J/M /P=$pathName fileName
endif
index += 1
while (1)
End
October 2, 2011 at 07:01 pm - Permalink
October 2, 2011 at 09:41 pm - Permalink