Re: Macro control over QuickTime Player window in ImageJ?

Posted by jmutterer on
URL: http://imagej.273.s1.nabble.com/Macro-control-over-QuickTime-Player-window-in-ImageJ-tp3699369p3699374.html

Dear all,

You can find out which keyCode triggered by a specific key on a given
keyboard by running ImageJ in debug mode and pressing this key.
I have a patch to Gabriel's robot that allows to specify a given keycode in
a the robot's keyPress string, including for example arrow keys.
in the robotText parsing loop, add the following 4 lines

else if (c == '&') {
 kc = java.lang.Integer.parseInt(robotText.substring(i+1,robotText.indexOf
(";",i+1)));
 i=robotText.indexOf(";",i+1);
}

// just before :

else
 kc=KeyEvent.VK_PERIOD;
//

this way, you can use the following syntax to specify a keyCode in a string
:

ima&65;&71;eJ  should output 'imageJ'

on my keyboard:
left arrow is &37;
right arrow is &39;
up arrow is &38;
down arrow is &40;

Jerome

On 5/22/07, Gabriel Landini <[hidden email]> wrote:

>
> On Tuesday 22 May 2007, you wrote:
> > I also just found this note on the documentation for IJ_Robot:
> > Note that in Mac OSX with an AZERTY keyboard, the typed string does
> > not get interpreted correctly.
>
> Yes, there is something strange in the way that the keys are reported
> using
> different keyboards. A string does not necessarily correspond to a key
> event
> or to a character value, apparently. It seems to depend on the keyboard
> one
> is using. But I am not sure.
>
> I am sorry but I do not have a solution to that at the moment. I would
> appreciate if anybody can clarify what is the relation between keyboard,
> string, character and key event.
>
> > Does this mean that KeyPress will not work on any of my Macs running
> OSX?
>
> You could do some test runs to male sure what string sends what key press.
> If
> one positions  the cursor in a text editor and sends the commands there,
> one
> can see what comes out.
> I know that this is not ideal, but I hope it helps anyway.
>
> Regards,
>
> Gabriel
>