Skip to content, Skip to search

Changes

Script Parameters

724 bytes added, 04:54, 9 April 2018
m
adds example of File array request
print(myFile)
</source>
 
You can request for multiple files as well. This was shown by [https://list.nih.gov/cgi-bin/wa.exe?A2=IMAGEJ;18cc58f.1804|a recent ImageJ Mailing List] post by Nicolas Chiaruttini.
 
Example in ImageJ Macro Language:
 
<source lang="python">
#@File[] listOfPaths(label="select files or folders", style="both")
 
print("There are "+listOfPaths.length+" paths selected.");
 
for (i=0;i<listOfPaths.length;i++) {
myFile=listOfPaths[i];
if (File.exists(myFile)) {
print(myFile + " exists.");
if (File.isDirectory(myFile)) {
print("Is a directory");
} else {
print("Is a file");
}
}
}
 
</source>
131
edits