Let the user choose a file ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Let the user choose a file ?

lechristophe
Is there a macro function that prompt the user to choose a file and
returns its path ?

The open() command can prompt the file chooser, but will open it, and I
don't want to open the file, just to get its path from the file chooser
dialog.

Christophe Leterrier
Reply | Threaded
Open this post in threaded view
|

Re: Let the user choose a file ?

Wayne Rasband
The File.openDialog() method, in ImageJ 1.39d and later, does this.
Here is an example:

     path = File.openDialog("Choose a File");
     print("path:", path);
     print("name:", File.getName(path));
     print("directory:", File.getParent(path));

-wayne

On Aug 20, 2007, at 11:19 AM, Christophe Leterrier wrote:

> Is there a macro function that prompt the user to choose a file and
> returns its path ?
>
> The open() command can prompt the file chooser, but will open it, and
> I don't want to open the file, just to get its path from the file
> chooser dialog.
>
> Christophe Leterrier
>