Easy way for modifying Shortcuts

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

Easy way for modifying Shortcuts

CARL Philippe (LBP)
Dear all,

I’m playing a lot with Shortcuts when I analyze some pictures since they
give the possibility to seriously accelerate the workflow.

But depending on the given type of analysis to perform, the use of different
lists of Shortcuts would be interesting.

And it is quite heavy to each time first "Remove" old Shortcuts and then
"Create" new ones when changing from a given analysis to another one.

Thus how is it possible to more easily access and modify the list of
Shortcuts by using for example a text editor software?

I thank you very much in advance for your help and answer.

Best regards,

Philippe

 

Philippe CARL

Laboratoire de Biophotonique et Pharmacologie

UMR 7213 CNRS - Université de Strasbourg

Faculté de Pharmacie

74 route du Rhin

67401 ILLKIRCH

Tel : +33(0)3 68 85 41 84


--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

Michael Schmid
Hi Philippe,

you can define shortcuts for macros.  Have the macro run the command you want.  These override the standard ImageJ macros (but they don't appear in the menus).

If you have macro sets, you can switch between them by installing one macro set or another, and so you get different sets of shortcuts.

You can even have one macro set install another one by something like
  run("Install...", "install="+getDirectory('macros')+"myNextMacroSet.txt");

--

You can also do the 'standard' ImageJ shortcut removal and adding commands with macros.
'Record Macros' tells you how:

  run("Create Shortcut... ", "command=[My Command] shortcut=0");
  run("Remove...", "command=[*My Command]");
  run("Refresh Menus"); //you don't need to restart ImageJ, even if it says so.

The disadvantage of the latter method is that you need to analyze the 'List Shortcuts' table to know which command currently uses a shortcut that you want to redefine.
Also, "Refresh Menus" loses the list of open windows in the 'Window' menu.


Michael
________________________________________________________________
On Nov 15, 2013, at 15:38, Philippe CARL wrote:

> Dear all,
>
> I’m playing a lot with Shortcuts when I analyze some pictures since they
> give the possibility to seriously accelerate the workflow.
>
> But depending on the given type of analysis to perform, the use of different
> lists of Shortcuts would be interesting.
>
> And it is quite heavy to each time first "Remove" old Shortcuts and then
> "Create" new ones when changing from a given analysis to another one.
>
> Thus how is it possible to more easily access and modify the list of
> Shortcuts by using for example a text editor software?
>
> I thank you very much in advance for your help and answer.
>
> Best regards,
>
> Philippe

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

CARL Philippe (LBP)
Dear Michael,
I thank you very much for your answer, but I'm afraid that I don't really
understand how to implement your first solution.
And for your second solution, how is it possible to retrieve the 'List
Shortcuts' table?
I thank you very much in advance for your answer.
Best regards,
Philippe

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de
Michael Schmid
Envoyé : vendredi 15 novembre 2013 15:59
À : [hidden email]
Objet : Re: Easy way for modifying Shortcuts

Hi Philippe,

you can define shortcuts for macros.  Have the macro run the command you
want.  These override the standard ImageJ macros (but they don't appear in
the menus).

If you have macro sets, you can switch between them by installing one macro
set or another, and so you get different sets of shortcuts.

You can even have one macro set install another one by something like
  run("Install...", "install="+getDirectory('macros')+"myNextMacroSet.txt");

--

You can also do the 'standard' ImageJ shortcut removal and adding commands
with macros.
'Record Macros' tells you how:

  run("Create Shortcut... ", "command=[My Command] shortcut=0");
  run("Remove...", "command=[*My Command]");
  run("Refresh Menus"); //you don't need to restart ImageJ, even if it says
so.

The disadvantage of the latter method is that you need to analyze the 'List
Shortcuts' table to know which command currently uses a shortcut that you
want to redefine.
Also, "Refresh Menus" loses the list of open windows in the 'Window' menu.


Michael
________________________________________________________________
On Nov 15, 2013, at 15:38, Philippe CARL wrote:

> Dear all,
>
> I’m playing a lot with Shortcuts when I analyze some pictures since
> they give the possibility to seriously accelerate the workflow.
>
> But depending on the given type of analysis to perform, the use of
> different lists of Shortcuts would be interesting.
>
> And it is quite heavy to each time first "Remove" old Shortcuts and
> then "Create" new ones when changing from a given analysis to another one.
>
> Thus how is it possible to more easily access and modify the list of
> Shortcuts by using for example a text editor software?
>
> I thank you very much in advance for your help and answer.
>
> Best regards,
>
> Philippe

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

Michael Schmid
Hi Philippe,

concerning the first solution, you can, e.g., have the following in StartupMacros.txt:

// Preprocessing shortcut key definitions
macro 'Despeckle [F1]' {
  run("Despeckle", "stack");
}
macro 'Remove standard outliers [F2]' {
  run("Remove Outliers...", "radius=2 threshold=50 which=Bright");
}
macro 'Switch to Analysis Macros [F7]' {
  run("Install...", "install="+getDirectory('macros')+"myAnalysisMacroSet.txt");
}

And in ImageJ/macros/myAnalysisMacroSet.txt you might have have

// Image analysis shortcut definitions
macro 'Analyze Big Nonspherical Particles [F1]' {
  run("Analyze Particles...", "size=999-Infinity circularity=0.4-1.00 show=Nothing display");
}
macro 'Analyze Small Round Particles [F2]' {
  run("Analyze Particles...", "size=0-9999 circularity=0.0-0.6 show=Nothing display");
}
macro 'Analyze Particles User-Defined [F3]' {
  run("Analyze Particles..."); //'Analyze Particles' dialog will be shown.
}
macro 'Switch Back to Preprocessing Macros [F8]' {
  run("Install...", "install="+getDirectory('macros')+"StartupMacros.txt");
}

---
For retrieving the shortcuts list and extracting shortcuts from it:

run("List Shortcuts...");
selectWindow("Keyboard Shortcuts");
list = getInfo("window.contents");
lines = split(list,'\n');
List.clear();
for (i=0; i<lines.length; i++) {
  items = split(lines[i],'\t');
  List.set(items[0], items[1]);
}
print (List.get('S')); //prints the command for shortcut 'S'

This way of programming depends much more on details of the implementation, e.g., it will fail if some future version of ImageJ should happen to have a different window title for the list of shortcuts...


Michael
________________________________________________________________
On Nov 19, 2013, at 16:05, Philippe CARL wrote:

> Dear Michael,
> I thank you very much for your answer, but I'm afraid that I don't really
> understand how to implement your first solution.
> And for your second solution, how is it possible to retrieve the 'List
> Shortcuts' table?
> I thank you very much in advance for your answer.
> Best regards,
> Philippe
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> Michael Schmid
> Envoyé : vendredi 15 novembre 2013 15:59
> À : [hidden email]
> Objet : Re: Easy way for modifying Shortcuts
>
> Hi Philippe,
>
> you can define shortcuts for macros.  Have the macro run the command you
> want.  These override the standard ImageJ macros (but they don't appear in
> the menus).
>
> If you have macro sets, you can switch between them by installing one macro
> set or another, and so you get different sets of shortcuts.
>
> You can even have one macro set install another one by something like
>  run("Install...", "install="+getDirectory('macros')+"myNextMacroSet.txt");
>
> --
>
> You can also do the 'standard' ImageJ shortcut removal and adding commands
> with macros.
> 'Record Macros' tells you how:
>
>  run("Create Shortcut... ", "command=[My Command] shortcut=0");
>  run("Remove...", "command=[*My Command]");
>  run("Refresh Menus"); //you don't need to restart ImageJ, even if it says
> so.
>
> The disadvantage of the latter method is that you need to analyze the 'List
> Shortcuts' table to know which command currently uses a shortcut that you
> want to redefine.
> Also, "Refresh Menus" loses the list of open windows in the 'Window' menu.
>
>
> Michael
> ________________________________________________________________
> On Nov 15, 2013, at 15:38, Philippe CARL wrote:
>
>> Dear all,
>>
>> I’m playing a lot with Shortcuts when I analyze some pictures since
>> they give the possibility to seriously accelerate the workflow.
>>
>> But depending on the given type of analysis to perform, the use of
>> different lists of Shortcuts would be interesting.
>>
>> And it is quite heavy to each time first "Remove" old Shortcuts and
>> then "Create" new ones when changing from a given analysis to another one.
>>
>> Thus how is it possible to more easily access and modify the list of
>> Shortcuts by using for example a text editor software?
>>
>> I thank you very much in advance for your help and answer.
>>
>> Best regards,
>>
>> Philippe
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

CARL Philippe (LBP)
Dear Peter,
I thank you very much for your help and looking at the code you sent me in
your previous mail, it is quite obvious that your level in programming is
quite far away from mine.
Thus using your excellent advices, I have tried to use the following code:

run("List Shortcuts...");
selectWindow("Keyboard Shortcuts");
list = getInfo("window.contents");
lines = split(list,'\n');
List.clear();
for (i=0; i<lines.length; i++)
{
  items = split(lines[i],'\t');
  List.set(items[0], items[1]);
}
run("Remove...", "command=["+List.get(' F2')+"]");
run("Create Shortcut... ", "command=[Open Recent File 1] shortcut=F2");
run("Refresh Menus");

First it took me quite some time to understand that in other to use the key
associated to the F2 key I needed to put a space in front of F2, i.e. use '
F2' instead of 'F2'. Is there a reason for this?
Then the code pasted higher is correctly erasing the Shortcut associated to
the F2 key, nevertheless Fiji really needs to be closed in order be able to
attribute a new Shortcut to the same key.
Why is this? Am I still doing something wrong?
I thank you very much in advance for your help.
Best regards,
Philippe

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de
Michael Schmid
Envoyé : mardi 19 novembre 2013 17:49
À : [hidden email]
Objet : Re: Easy way for modifying Shortcuts

Hi Philippe,

concerning the first solution, you can, e.g., have the following in
StartupMacros.txt:

// Preprocessing shortcut key definitions macro 'Despeckle [F1]' {
  run("Despeckle", "stack");
}
macro 'Remove standard outliers [F2]' {
  run("Remove Outliers...", "radius=2 threshold=50 which=Bright"); } macro
'Switch to Analysis Macros [F7]' {
  run("Install...",
"install="+getDirectory('macros')+"myAnalysisMacroSet.txt");
}

And in ImageJ/macros/myAnalysisMacroSet.txt you might have have

// Image analysis shortcut definitions
macro 'Analyze Big Nonspherical Particles [F1]' {
  run("Analyze Particles...", "size=999-Infinity circularity=0.4-1.00
show=Nothing display"); } macro 'Analyze Small Round Particles [F2]' {
  run("Analyze Particles...", "size=0-9999 circularity=0.0-0.6 show=Nothing
display"); } macro 'Analyze Particles User-Defined [F3]' {
  run("Analyze Particles..."); //'Analyze Particles' dialog will be shown.
}
macro 'Switch Back to Preprocessing Macros [F8]' {
  run("Install...", "install="+getDirectory('macros')+"StartupMacros.txt");
}

---
For retrieving the shortcuts list and extracting shortcuts from it:

run("List Shortcuts...");
selectWindow("Keyboard Shortcuts");
list = getInfo("window.contents");
lines = split(list,'\n');
List.clear();
for (i=0; i<lines.length; i++) {
  items = split(lines[i],'\t');
  List.set(items[0], items[1]);
}
print (List.get('S')); //prints the command for shortcut 'S'

This way of programming depends much more on details of the implementation,
e.g., it will fail if some future version of ImageJ should happen to have a
different window title for the list of shortcuts...


Michael
________________________________________________________________
On Nov 19, 2013, at 16:05, Philippe CARL wrote:

> Dear Michael,
> I thank you very much for your answer, but I'm afraid that I don't
> really understand how to implement your first solution.
> And for your second solution, how is it possible to retrieve the 'List
> Shortcuts' table?
> I thank you very much in advance for your answer.
> Best regards,
> Philippe
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> Michael Schmid Envoyé : vendredi 15 novembre 2013 15:59 À :
> [hidden email] Objet : Re: Easy way for modifying Shortcuts
>
> Hi Philippe,
>
> you can define shortcuts for macros.  Have the macro run the command
> you want.  These override the standard ImageJ macros (but they don't
> appear in the menus).
>
> If you have macro sets, you can switch between them by installing one
> macro set or another, and so you get different sets of shortcuts.
>
> You can even have one macro set install another one by something like  
> run("Install...",
> "install="+getDirectory('macros')+"myNextMacroSet.txt");
>
> --
>
> You can also do the 'standard' ImageJ shortcut removal and adding
> commands with macros.
> 'Record Macros' tells you how:
>
>  run("Create Shortcut... ", "command=[My Command] shortcut=0");  
> run("Remove...", "command=[*My Command]");  run("Refresh Menus");
> //you don't need to restart ImageJ, even if it says so.
>
> The disadvantage of the latter method is that you need to analyze the
> 'List Shortcuts' table to know which command currently uses a shortcut
> that you want to redefine.
> Also, "Refresh Menus" loses the list of open windows in the 'Window' menu.
>
>
> Michael
> ________________________________________________________________
> On Nov 15, 2013, at 15:38, Philippe CARL wrote:
>
>> Dear all,
>>
>> I’m playing a lot with Shortcuts when I analyze some pictures since
>> they give the possibility to seriously accelerate the workflow.
>>
>> But depending on the given type of analysis to perform, the use of
>> different lists of Shortcuts would be interesting.
>>
>> And it is quite heavy to each time first "Remove" old Shortcuts and
>> then "Create" new ones when changing from a given analysis to another
one.

>>
>> Thus how is it possible to more easily access and modify the list of
>> Shortcuts by using for example a text editor software?
>>
>> I thank you very much in advance for your help and answer.
>>
>> Best regards,
>>
>> Philippe
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

Michael Schmid
Hi Philippe,

the extra space for 'Fn' shortcut keys is probably meant to get the F-keys at the top in the sorted list (it's in ij.plugin.CommandLister.java, line 57).  When doing a hack like the one we are discussing here, one may easily run into such problems; that's why I thought the other method with macro sets would be nicer...

For adding a shortcut, you have to run("Refresh Menus") after deleting the old one and *before* adding the new one.

And you might want a run("Close") after list = getInfo("window.contents"); otherwise the 'Keyboard Shortcuts' window will stay on the screen forever.

Michael   (not Peter ;-)
________________________________________________________________
On Nov 21, 2013, at 15:17, Philippe CARL wrote:

> Dear Peter,
> I thank you very much for your help and looking at the code you sent me in
> your previous mail, it is quite obvious that your level in programming is
> quite far away from mine.
> Thus using your excellent advices, I have tried to use the following code:
>
> run("List Shortcuts...");
> selectWindow("Keyboard Shortcuts");
> list = getInfo("window.contents");
> lines = split(list,'\n');
> List.clear();
> for (i=0; i<lines.length; i++)
> {
>  items = split(lines[i],'\t');
>  List.set(items[0], items[1]);
> }
> run("Remove...", "command=["+List.get(' F2')+"]");
> run("Create Shortcut... ", "command=[Open Recent File 1] shortcut=F2");
> run("Refresh Menus");
>
> First it took me quite some time to understand that in other to use the key
> associated to the F2 key I needed to put a space in front of F2, i.e. use '
> F2' instead of 'F2'. Is there a reason for this?
> Then the code pasted higher is correctly erasing the Shortcut associated to
> the F2 key, nevertheless Fiji really needs to be closed in order be able to
> attribute a new Shortcut to the same key.
> Why is this? Am I still doing something wrong?
> I thank you very much in advance for your help.
> Best regards,
> Philippe
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
> Michael Schmid
> Envoyé : mardi 19 novembre 2013 17:49
> À : [hidden email]
> Objet : Re: Easy way for modifying Shortcuts
>
> Hi Philippe,
>
> concerning the first solution, you can, e.g., have the following in
> StartupMacros.txt:
>
> // Preprocessing shortcut key definitions macro 'Despeckle [F1]' {
>  run("Despeckle", "stack");
> }
> macro 'Remove standard outliers [F2]' {
>  run("Remove Outliers...", "radius=2 threshold=50 which=Bright"); } macro
> 'Switch to Analysis Macros [F7]' {
>  run("Install...",
> "install="+getDirectory('macros')+"myAnalysisMacroSet.txt");
> }
>
> And in ImageJ/macros/myAnalysisMacroSet.txt you might have have
>
> // Image analysis shortcut definitions
> macro 'Analyze Big Nonspherical Particles [F1]' {
>  run("Analyze Particles...", "size=999-Infinity circularity=0.4-1.00
> show=Nothing display"); } macro 'Analyze Small Round Particles [F2]' {
>  run("Analyze Particles...", "size=0-9999 circularity=0.0-0.6 show=Nothing
> display"); } macro 'Analyze Particles User-Defined [F3]' {
>  run("Analyze Particles..."); //'Analyze Particles' dialog will be shown.
> }
> macro 'Switch Back to Preprocessing Macros [F8]' {
>  run("Install...", "install="+getDirectory('macros')+"StartupMacros.txt");
> }
>
> ---
> For retrieving the shortcuts list and extracting shortcuts from it:
>
> run("List Shortcuts...");
> selectWindow("Keyboard Shortcuts");
> list = getInfo("window.contents");
> lines = split(list,'\n');
> List.clear();
> for (i=0; i<lines.length; i++) {
>  items = split(lines[i],'\t');
>  List.set(items[0], items[1]);
> }
> print (List.get('S')); //prints the command for shortcut 'S'
>
> This way of programming depends much more on details of the implementation,
> e.g., it will fail if some future version of ImageJ should happen to have a
> different window title for the list of shortcuts...
>
>
> Michael
> ________________________________________________________________
> On Nov 19, 2013, at 16:05, Philippe CARL wrote:
>
>> Dear Michael,
>> I thank you very much for your answer, but I'm afraid that I don't
>> really understand how to implement your first solution.
>> And for your second solution, how is it possible to retrieve the 'List
>> Shortcuts' table?
>> I thank you very much in advance for your answer.
>> Best regards,
>> Philippe
>>
>> -----Message d'origine-----
>> De : ImageJ Interest Group [mailto:[hidden email]] De la part de
>> Michael Schmid Envoyé : vendredi 15 novembre 2013 15:59 À :
>> [hidden email] Objet : Re: Easy way for modifying Shortcuts
>>
>> Hi Philippe,
>>
>> you can define shortcuts for macros.  Have the macro run the command
>> you want.  These override the standard ImageJ macros (but they don't
>> appear in the menus).
>>
>> If you have macro sets, you can switch between them by installing one
>> macro set or another, and so you get different sets of shortcuts.
>>
>> You can even have one macro set install another one by something like  
>> run("Install...",
>> "install="+getDirectory('macros')+"myNextMacroSet.txt");
>>
>> --
>>
>> You can also do the 'standard' ImageJ shortcut removal and adding
>> commands with macros.
>> 'Record Macros' tells you how:
>>
>> run("Create Shortcut... ", "command=[My Command] shortcut=0");  
>> run("Remove...", "command=[*My Command]");  run("Refresh Menus");
>> //you don't need to restart ImageJ, even if it says so.
>>
>> The disadvantage of the latter method is that you need to analyze the
>> 'List Shortcuts' table to know which command currently uses a shortcut
>> that you want to redefine.
>> Also, "Refresh Menus" loses the list of open windows in the 'Window' menu.
>>
>>
>> Michael
>> ________________________________________________________________
>> On Nov 15, 2013, at 15:38, Philippe CARL wrote:
>>
>>> Dear all,
>>>
>>> I’m playing a lot with Shortcuts when I analyze some pictures since
>>> they give the possibility to seriously accelerate the workflow.
>>>
>>> But depending on the given type of analysis to perform, the use of
>>> different lists of Shortcuts would be interesting.
>>>
>>> And it is quite heavy to each time first "Remove" old Shortcuts and
>>> then "Create" new ones when changing from a given analysis to another
> one.
>>>
>>> Thus how is it possible to more easily access and modify the list of
>>> Shortcuts by using for example a text editor software?
>>>
>>> I thank you very much in advance for your help and answer.
>>>
>>> Best regards,
>>>
>>> Philippe
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

CARL Philippe (LBP)
Hi Michael,

> the extra space for 'Fn' shortcut keys is probably meant to get the F-keys
at the top in the sorted list (it's in
> ij.plugin.CommandLister.java, line 57).

Ok thanks a lot for this explanation.

> When doing a hack like the one we are discussing here, one may easily run
into such problems; that's why I thought the other
> method with macro sets would be nicer...

On the other hand with the other method you won't see the list of Shortcuts
showing up in the list, isn't it?

> For adding a shortcut, you have to run("Refresh Menus") after deleting the
old one and *before* adding the new one.

Actually I had forgotten to precise this, but adding run("Refresh Menus")
before adding the new one won't do the trick as well and you really need to
close Fiji for the key deselection to be effective.

> And you might want a run("Close") after list = getInfo("window.contents");
otherwise the 'Keyboard Shortcuts' window will
> stay on the screen forever.

Indeed, thanks a lot.

> Michael   (not Peter ;-)

Sorry for the mistake.

Best regards,

Philippe

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

Bill Christens-Barry-2
In reply to this post by CARL Philippe (LBP)
Michael,

"Refresh Menus" uninstalls installed macros in ImageJ, so Philippe will need to reinstall any that he wants to remain available. This will reinitialize variables used in those macros unless some means of preserving them is used. Maybe an installed macro could print the values of these variables to the Log window beforehand and a reloaded macro could restore them from the Log window afterward.

Bill Christens-Barry

{
Hi Philippe,

the extra space for 'Fn' shortcut keys is probably meant to get the F-keys at the top in the sorted list (it's in ij.plugin.CommandLister.java, line 57).  When doing a hack like the one we are discussing here, one may easily run into such problems; that's why I thought the other method with macro sets would be nicer...

For adding a shortcut, you have to run("Refresh Menus") after deleting the old one and *before* adding the new one.

And you might want a run("Close") after list = getInfo("window.contents"); otherwise the 'Keyboard Shortcuts' window will stay on the screen forever.

Michael   (not Peter ;-)
}

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: Easy way for modifying Shortcuts

Michael Schmid
In reply to this post by CARL Philippe (LBP)
Hi Philippe,

> On the other hand with the other method you won't see the list of Shortcuts
> showing up in the list, isn't it?

If you have macro sets for defining the shortcuts, at least in my version of ImageJ both the original mapping (if present) and the macro appear in the list of shortcuts.
Macros appear with a caret.
E.g. for shift-B, which I usually replace with a macro of mine, I see in the list
        B Blobs (25K)
        B ^myBmacro [B]

If there is only a macro, no previous ImageJ assignment of the shortcut, it appears also. Numeric.keypad shortcuts appear in the list with a special character for the keypad (it may be destroyed by the mailer):
        ⌨ + ^myZoom-InMacro [n+]
The special ⌨ (KEYBOARD) character is Unicode hex 2328.
Again something that might be tricky to handle properly...

In addition, the installed macros appear with their shortcut in Plugins>Macros below 'Record'.

If your macros supersede a shortcut assignment by ImageJ, the original will be back as soon as you install another macro set that does not supersede that shortcut.  Compared to redefining shortcuts, I consider this another advantage of the macro approach.

Michael
________________________________________________________________
On Nov 21, 2013, at 17:14, Philippe CARL wrote:

> Hi Michael,
>
>> the extra space for 'Fn' shortcut keys is probably meant to get the F-keys
> at the top in the sorted list (it's in
>> ij.plugin.CommandLister.java, line 57).
>
> Ok thanks a lot for this explanation.
>
>> When doing a hack like the one we are discussing here, one may easily run
> into such problems; that's why I thought the other
>> method with macro sets would be nicer...
>
> On the other hand with the other method you won't see the list of Shortcuts
> showing up in the list, isn't it?
>
>> For adding a shortcut, you have to run("Refresh Menus") after deleting the
> old one and *before* adding the new one.
>
> Actually I had forgotten to precise this, but adding run("Refresh Menus")
> before adding the new one won't do the trick as well and you really need to
> close Fiji for the key deselection to be effective.
>
>> And you might want a run("Close") after list = getInfo("window.contents");
> otherwise the 'Keyboard Shortcuts' window will
>> stay on the screen forever.
>
> Indeed, thanks a lot.
>
>> Michael   (not Peter ;-)
>
> Sorry for the mistake.
>
> Best regards,
>
> Philippe
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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