Robotjs: New key, right_alt would be appreciate :)

Created on 10 Sep 2016  Â·  23Comments  Â·  Source: octalmage/robotjs

Hello there, great job in this repo!
Just an issue to mention that I would appreciate the use of the missing key "right_alt".

enhancement in progress

Most helpful comment

Hi! Glad you like it.

You can add keycodes here:

https://github.com/octalmage/robotjs/blob/master/src/keycode.h#L58

There's an enum for each OS. Then it will need to be added here:

https://github.com/octalmage/robotjs/blob/master/src/robotjs.cc#L336

Let me know if you need any help!

All 23 comments

In fact, I miss several other keycodes, could you explain me how to add one? I will contribute for the others and submit my pull requests.

Hi! Glad you like it.

You can add keycodes here:

https://github.com/octalmage/robotjs/blob/master/src/keycode.h#L58

There's an enum for each OS. Then it will need to be added here:

https://github.com/octalmage/robotjs/blob/master/src/robotjs.cc#L336

Let me know if you need any help!

Looks like it's just kVK_RightOption vk_rightalt and k_rightalt according to many platforms
I only doubt the RightOption, images tell me alt and option share a key, but some images uses an icon instead

If you're looking for more keycodes
https://github.com/weeeBox/oldies-xna-framework/blob/4c1a19552539a6a497c1071e9d8957dd34651804/trunk/Framework/AsapXna/asap/core/KeyCode.cs#L152

https://github.com/soegaard/remacs/blob/1b184add294a8ff5aa55ea30b82eb1e3bf91e643/osx-keyboard.rkt

https://gist.github.com/JohnJB/5662272

Thank you both for your help!

This is a spreadhseet containing the information you gave me.
I am wondering if there are no conflit between them. I left empty the cells that are not valid assuming the policy I guess for this project. What brings me to think that these empty cells may be conflicting if I fill them? For two unlinked reasons :

  • About the Windows column of the RobotJS sheet : The keys I found from the link given by @Scrxtchy are not the same than the ones I found in this file https://github.com/octalmage/robotjs/blob/master/src/keycode.h#L58 :

    • For instance for K_PAGEUP :

    • RobotJS keycode.h gives me : VK_PRIOR

    • The other link gives me VK_PageUp

    • The case is also upper for RobotJS keycode.h only for Windows and this seems also conflicting with the link.

  • About Linux column :

    • In the link given I have no XF86XK_* keys

Ahh, so it seems
This might be a bit more accurate

https://github.com/me2d13/luamacros/blob/eee57bddff37396345173c647240982f526932e5/src/uSendKeys.pas
This comes out of software I actually use

Okay thank you, I'll check. The case is still confusing me, should I use upper or not?

The fSequence[I] case?
don't worry about it, it's for the software to handle pressing shift or modifiers alongside a key, like an autohotkey script

  elseif (button == 106) then lmc_send_keys('%{F24}') --Astericks
  elseif (button == 111) then lmc_send_keys('^{F23}') --forward slash   

Hum... What I am wondering is : Can I use these keynames in RobotJS keycode.h in upper case?

Any idea of a link where I can find XF86XK_* keys ? :D I am looking forward to begin to code^^.

I am unsure really, these are added manually due to them not being in the library, so instead it's providing the number used, instead of the reference variable, thus the inconstancy. And as pascal is a non-case sensitive language, as these are that freedom exists for future referral in the application

Okay, I'll try and tell you if builds work^^.

If I could bother to set up gyp for actually building anything now I could hammer it out myself as well and see what works
But it's too much of a hassle

Haha you are right!

Hey,

So I reach to build the code from files :

But when I run this :
var robot = require('../local_packages/robotjs/build/Release/robotjs.node') robot.keyTap("control_right")

This is the error I have :
robot.keyTap("control_right")
^
Error: Invalid key code specified.
at Error (native)
at Object. (/home/hadrien-toma/dev/nodejs/test/index.js:5:7)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.runMain (module.js:575:10)
at run (bootstrap_node.js:352:7)
at startup (bootstrap_node.js:144:9)

It seems to be the same for all keys I added. An idea of what I have to do next?

Hi @hadrien-toma,

Did you rebuild the binary with node-gyp? The source fils look correct.

Hi @octalmage ;)

My build line is :
rm -rf ./build ; rm -rf node_modules ; npm install
I think this triggers node-gyp, doesn't it?

By default npm install will download the pre-built binaries. You'll need to run

node-gyp rebuild

In node_modules/robotjs/

Yeah! It doesn't trigger any error anymore now so I suppose it works but I am facing this issue #235 ...
As soon as I have solve it I will pull request all my changes. I also plan to add more keys again during this time :D.

Would any modifications of this nature be open for pull requests?

I will emit a pull request as soon as I have tested my changes to not commit untested code but if someone else wants to test it for us (and tell us the result^^), my changes are in the 2 abovementioned files, I will thank him for that.

So sorry for having closed the issue :s.

still nothing ? I've spent some time on it but it seems that no keyboard code fit for the right alt (AltGr).
after editing the files as you submitted I just can't compile anything ... some binding.gyp error ... I just can't spend some more time on it by now . but maybe will soon.
great job by the way, it's one of the best automation module I've see !
(ps: I've met some trouble with the € thing also... but maybe related, it uses the AltGr key to type)

Unfortunately, I don't see how to fix neither #235 nor #16, so I still can't use my modifications :( ... If you reach to something later, I will thank you to let us know! ;)

This issue has been closed because it has been inactive for > 180 days.
You may reopen this issue if it has been closed in error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

piyushpatil027 picture piyushpatil027  Â·  3Comments

poojas2288 picture poojas2288  Â·  8Comments

poojas2288 picture poojas2288  Â·  5Comments

IChocolateKapa picture IChocolateKapa  Â·  12Comments

MariaDima picture MariaDima  Â·  3Comments