Login  Register

Re: Use RecentOpener in Shortcut

Posted by Michael Schmid on Dec 17, 2012; 4:40pm
URL: http://imagej.273.s1.nabble.com/Use-RecentOpener-in-Shortcut-tp5001144p5001187.html

Hi Philippe,


Well, I have not tried, but it might work like the following:

First you need the path+name of the recent file:
  String recentFile=openRecentMenu.getItem(i).getLabel();
where 'i' is 0 for the most recent and 1 for the file before.

Then, if that file is not a blank String, you can use
  new RecentOpener(recentFile);

Note that opening recentFile number 1 this way will put it on top of the 'recent' list, so it will become recentFile 0. If you want to leave the 'Open Recent' menu untouched, use
  IJ.open(recentFile); or
  ImagePlus imp = IJ.openImage(recentFile);

Michael
________________________________________________________________


On Dec 13, 2012, at 15:52, Philippe CARL wrote:

> Dear all,
>
> I would like to create Shortcuts (let's say F1 and F2) in order to open the
> first and second file that can be found in the File/Open Recent submenu.
>
> I figured out that I should create a plugin calling the RecentOpener class
> for this but have no clue on how to do it.
>
> So I thank you very much in advance for a little help.
>
> Best regards,
>
> Philippe

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