Using Shift as modifier with F-keys in macros

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

Using Shift as modifier with F-keys in macros

Stein Rørvik
Install this macro; and launch it via F1 with and without a modifier key:

macro "Test Macro [F1]" {
                message = "";
                if (isKeyDown("alt")) message += ", alt";
                if (isKeyDown("shift")) message += ", shift";
                if (isKeyDown("space")) message += ", space";
                showMessage("Macro F1" + message);
}

It works as expected alone and with the alt and space keys, but not shift.
With shift-F1 the macro does not launch at all.

Is shift-F1 mapped to a different scan code on the Windows keyboard,
or is there any other reason this does not work as expected?
What happens under Mac and Linux?

I am using daily build ImageJ 1.52m with Java 1.8 on Windows 7/64-bit.


Stein


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

Re: Using Shift as modifier with F-keys in macros

Wayne Rasband-2
> On Mar 20, 2019, at 8:13 AM, Stein Rørvik <[hidden email]> wrote:
>
> Install this macro; and launch it via F1 with and without a modifier key:
>
> macro "Test Macro [F1]" {
>                message = "";
>                if (isKeyDown("alt")) message += ", alt";
>                if (isKeyDown("shift")) message += ", shift";
>                if (isKeyDown("space")) message += ", space";
>                showMessage("Macro F1" + message);
> }
>
> It works as expected alone and with the alt and space keys, but not shift.
> With shift-F1 the macro does not launch at all.

This bug is fixed in the latest ImageJ daily build (1.52o3).

-wayne

> Is shift-F1 mapped to a different scan code on the Windows keyboard,
> or is there any other reason this does not work as expected?
> What happens under Mac and Linux?
>
> I am using daily build ImageJ 1.52m with Java 1.8 on Windows 7/64-bit.
>
>
> Stein

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

Re: Using Shift as modifier with F-keys in macros

Stein Rørvik
Thanks for the quick fix;

with isKeyDown now accepting control key as well the example macro can be written as

macro "Test Macro [F1]" {
        message = "";
        if (isKeyDown("alt")) message += ", alt";
        if (isKeyDown("space")) message += ", space";
        if (isKeyDown("shift")) message += ", shift";
        if (isKeyDown("control")) message += ", control";
        showMessage("Macro F1" + message);
}  

and works as expected with all four modifier keys, even pressed simultaneously.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Wayne Rasband
Sent: 23. mars 2019 22:12
To: [hidden email]
Subject: Re: Using Shift as modifier with F-keys in macros

> On Mar 20, 2019, at 8:13 AM, Stein Rørvik <[hidden email]> wrote:
>
> Install this macro; and launch it via F1 with and without a modifier key:
>
> macro "Test Macro [F1]" {
>                message = "";
>                if (isKeyDown("alt")) message += ", alt";
>                if (isKeyDown("shift")) message += ", shift";
>                if (isKeyDown("space")) message += ", space";
>                showMessage("Macro F1" + message); }
>
> It works as expected alone and with the alt and space keys, but not shift.
> With shift-F1 the macro does not launch at all.

This bug is fixed in the latest ImageJ daily build (1.52o3).

-wayne

> Is shift-F1 mapped to a different scan code on the Windows keyboard,
> or is there any other reason this does not work as expected?
> What happens under Mac and Linux?
>
> I am using daily build ImageJ 1.52m with Java 1.8 on Windows 7/64-bit.
>
>
> Stein

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

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