Re: macro command to designate but not open a file?

Posted by ctrueden on
URL: http://imagej.273.s1.nabble.com/macro-command-to-designate-but-not-open-a-file-tp5014926p5014928.html

Hi Bill,

> I'd like to navigate to and choose but not open a file
> so I can assign its name (or full path) to a variable.

The relevant function is File.openDialog.

Here is an example:
http://imagej.net/macros/OpenDialogDemo.txt

Or, you can use the ImageJ2 parameterized scripting approach and add a File
parameter to the very top of your script. E.g.:

  // @File path
  print("Path:", path);

For further details, see:
http://imagej.net/Script_parameters

Regards,
Curtis

On Thu, Nov 12, 2015 at 9:00 AM, Bill Christens-Barry <[hidden email]>
wrote:

> In a macro I'd like to navigate to and choose but not open a file so I can
> assign its name (or full path) to a variable. I haven't identified a means
> of doing this using the File.* or getDirectory() macro commands. Is there a
> way to do this?
>
> Also, I'd like to specify a default starting path for the getDirectory()
> macro command, but don't see a way to do this. Is there a means for doing
> this in the macro language?
>
> Thanks,
>
> Bill
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html