Select folder rather than file

I would like to be able to have the user select a folder rather than a file. The Packages.ij.io.OpenDialog java class only seems to allow choosing a file.

Try using script parameters:

// @File(style="directory") dir
print("You chose " + dir);
1 Like

Found it: importClass(Packages.ij.io.DirectoryChooser);

Learning how to search for and use the java classes.

I don’t know how to use the script parameters. Are there some examples somewhere you can point me to?

See:

  1. The Script parameters web page, which documents the syntax.
  2. The Script Templates web page, which describes the Templates menu of the Script Editor. There are quite a few examples in that menu.
1 Like