Coder Social home page Coder Social logo

node-key-sender's People

Contributors

amiraslanaslani avatar cmdpromptcritical avatar fernandohu avatar okonek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-key-sender's Issues

Not Working for Programs?!

Hey,

i tried to use the key sender to press a hotkey in a software. in this software, the letter "q" triggers a scene. unfortunatently, the program didnt recognize the keypress. browser, notepad works just fine. does it not work for programs, just for textinput?

Greetings from Germany

Feature: Audio keys support

Short overview
Can you please add the audio keys

Use case
To expand the possibilities when using those keys in different keyboards that doesn't have those keys

Detailed feature description
Those are the requested keys

  • audio_mute
  • audio_vol_down
  • audio_vol_up
  • audio_play
  • audio_stop
  • audio_pause
  • audio_prev
  • audio_next

Additional content

Please provide any (mandatory) additional data for your desired feature
I would like to simulate those keys because not all the keyboards have those special keys

Where are the keys sent?

I am using macOS Catalina 10.15.7. I have a simple program,

var nodeKeySender = require('node-key-sender');

nodeKeySender.sendKey('a');
nodeKeySender.sendKey('a');
nodeKeySender.sendKey('a');
nodeKeySender.sendKey('a'); 

when I run the file using node file.ts it executes successfully and takes me to the Desktop 1 where 4 java applets open up and then close. I also have a text file open. But nothing gets printed in the text file. So where exactly are the keys sent?

I think the focus might be going away when the java applets run, so, i clicked on the text file after running the program to get back the focus on the text file and also introduced a delay.

nodeKeySender.startBatch()
    .batchTypeKey('N')
    .batchTypeKey('o')
    .batchTypeKey('d')
    .batchTypeKey('e')
    .batchTypeKeys(['N', 'o', 'd', 'e'])
    .batchTypeText('Node')
    .batchTypeKey('N', 1000)
    .batchTypeKey('o', 1000)
    .batchTypeKey('d', 1000)
    .batchTypeKey('e', 1000)
    .sendBatch().then(
        function(stdout, stderr) {
            console.log('success', stderr, stdout);
        },        
        function(error, stdout, stderr) {
            console.log('error', error, stdout, stderr);
        }
    );

Still nothing gets printed.

Cannot access key-sender.jar from webpack bundle

Hello there!

I've tried to bundle this module for an app using webpack. The bundle is compiled with no errors, but at runtime, the app throws some errors regarding the fact that it cannot access the key-sender.jar file.

image

Also, here is my webpack configuration:

const webpack = require('webpack');
const path = require('path');

module.exports = {
    target: "node",
    entry: path.resolve(__dirname, 'src/reader.js'),
    output: {
        filename: 'reader.bundle.js',
        path: path.resolve(__dirname, 'bin')
    },
    resolve: {
        modules: ["node_modules", __dirname],
        alias: {
        	'node-hid': path.resolve(__dirname, 'node_modules/node-hid/build/Release/HID.node')
        }
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /(node_modules|bower_components)/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['env']
                    }
                }
            }
        ]
    },
    stats: {
        colors: true
    },
    plugins: [
        new webpack.optimize.UglifyJsPlugin({
            beautify: false,
            comments: false
        }),
        new webpack.ContextReplacementPlugin(
        	/[\/\\]node_modules[\/\\]node-hid[\/\\]nodehid.js/,
        	/[\/\\]node_modules[\/\\]node-hid[\/\\]build[\/\\]Release[\/\\]*.node/    
        )
    ],
    externals: {
        "node-hid": 'commonjs node-hid'
    }

}

Have you encountered this before?
Thank you ahead of time :)

"Error: Unable to access jarfile" if spaces in folder name (with fix)

Windows 10, Node 8.10.0, webdriverio
The fix is to use double quotes not escaped single quotes in key-sender.js Line 115:

Instead of:
var command = 'java -jar '' + jarPath + '' ' + arrParams.join(' ') + module.getCommandLineOptions();

Use:
var command = 'java -jar "' + jarPath + '" ' + arrParams.join(' ') + module.getCommandLineOptions();

Exec is not a function Error arises

I am trying to implement node-key-sender in my Cypress automation test for generating "ctrl+w" combination for closing browser tab. Unfortunately the commands
const ks = require('node-key-sender'); ks.sendCombination(['control', 'w']);
results "exec is not a function" error:

`node_modules/node-key-sender/key-sender.js:117:1
115 | var command = 'java -jar "' + jarPath + '" ' + arrParams.join(' ') + module.getCommandLineOptions();
116 |

117 | return exec(command, {}, function(error, stdout, stderr) {
| ^
118 | if (error == null) {
119 | resolve(stdout, stderr);
120 | } else {`

JRE is installed on my Windows machine.

Node-key-sender doesn't work after build

Hi,

During testing, Node-Key-Sender works great but as soon as I build the app it doesn't work.

Error:
Uncaught (in promise) Error: Command failed: java -jar "C:\Users<username>\github<appname>\dist\win-unpacked\resources\app.asar\node_modules\node-key-sender\jar\key-sender.jar" windows-shift-s

Any assistance in resolving this issue would be great.

Single quotes around JAR file stops the jar file from running

I get his error when I try to run my javascript in Windows 10:

Error: Command failed: java -jar 'C:\Users\chris\Downloads\key-sender-master\key-sender-master\node_modules\node-key-sender\jar\key-sender.jar' a b c
Error: Unable to access jarfile 'C:\Users\chris\Downloads\key-sender-master\key-sender-master\node_modules\node-key-sender\jar\key-sender.jar'

The jar file does exist. If I run this from the command line then I get the exact same message.

If I remove the single quotes around the jar file or replace them with double-quotes, then it works fine:

java -jar "C:\Users\chris\Downloads\key-sender-master\key-sender-master\node_modules\node-key-sender\jar\key-sender.jar"

The fix is easy, but I'm just curios why no-one has seen this issue before in Windows.

An error :)

using with selenium webdriver
in the smaller code it works perfectly but in a bit bigger it fails don't know why yet.... buI'm alreaady here....good eveinign

r: Command failed: java -jar "D:\SELENIUM\driverConfig\node_modules\node-key-sender\jar\key-sender.jar" control-q
'java' is not recognized as an internal or external command,
operable program or batch file.

at ChildProcess.exithandler (node:child_process:333:12)
at ChildProcess.emit (node:events:379:20)
at maybeClose (node:internal/child_process:1069:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:300:5) {

killed: false,
code: 1,
signal: null,
cmd: 'java -jar "D:\SELENIUM\driverConfig\node_modules\node-key-sender\jar\key-sender.jar" control-q'
}

sending any character via .sendLetter?

Hi! I'm trying to send different characters with no success. For example: "आ". How can I make the lib send this symbol? Sorry if this is a stupid question, but I tried a lot of stuff and it didn't help. Looking forward for your help!

Steals focus from the app on OS X 10.14.3

OS X 10.14.3.

I enabled accessbility access, when the keystrokes should be sent, I see "Keysender" show in the top left of the menu bar, and focus is taken away from the application that had focus. I've tried chrome, vscode, slack, and all of them lose focus when the key should be sent, and no keys appear sent.

require('node-key-sender') return undefined in node red

Hi, I'm trying to use node-key-sender in node-red.
I use the functionGlobalContext like this :
functionGlobalContext: { ..., robot:require('node-key-sender') }
But when I do :
`var robot = global.get('robot');

node.log(robot);`

It returns Undefined.

I've already done : npm install and the package 'node-key-sender' does exist at ~/.node-red/node_modules

Can anyone help please ?

sendCombination also sends characters on Discord

When using the combo "Alt+Down" or "Alt+Up", the module seems to output emoji characters into the textbox of Discord (even though the key combo performs normally). So far, Discord seems to be the only app that this is happening with, but I'm sure it isn't the only one.
image

To use the "java" command-line tool you need to install a JDK

I'm trying to get node-key-sender running in an electron project. Every time I use node-key-sender I get a popup with 'To use the "java" command-line tool you need to install a JDK'.

I've followed the "More info..." button that brings me to java.com. I've downloaded Java 8 on the website but I still have to popup.

I've found this website: https://www.theitsage.com/fix-java-command-line-tool-popup-mac/
that talks about this issue, but the package they recommend is to download JRE 6 for old depreciated applications. Does node-key-sender really use this (It says on in the README that the minimum version is 8)?

How to combine with pkg?

I made a very simple program that presses the 'delete' key when I play a certain MIDI-note on my instrument, for a personal application. I built the program with pkg (https://github.com/vercel/pkg) but it won't work because it can't find the jar.
Error: Unable to access jarfile C:\snapshot\midiDelete\node_modules\node-key-sender\jar\key-sender.jar
where midiDelete is the name of my repository. This is the output I get when I run the .exe after building it with pkg.
Any ideas how to fix this?

Using node-key-sender inside container

Hi. I'm trying to use node-key-sender lib inside a docker container.
I installed Java inside this container but it didn't worked.
I would like to know if someone already did that. What could I been doing wrong ? Should I use Java installed outside container ?

Thanks in advance.

Node-key-sender doesn't work after build

I have used node-key-sender in an electron application. I works fine in my system. I have build it using electron-builder and installed the app in other systems. when I try to run the application it shows the error message

libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[67890:0207/194700.271830:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 1 times!
[67890:0207/194703.274367:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 2 times!
[67890:0207/194705.282643:ERROR:gl_surface_presentation_helper.cc(260)] GetVSyncParametersIfAvailable() failed for 3 times!

I have googled and found it is related to graphics configuration. is there any dependency for node-key-sender with system configuration

shift is ignored in combinations with non-letter keys

Combination with shift and non-letter buttons do not work as expected. Seems like shift is ignored.

Not a full list:

ks.sendCombination(['shift', 'left'])
ks.sendCombination(['shift', 'right'])
ks.sendCombination(['shift', 'up'])
ks.sendCombination(['shift', 'down'])
ks.sendCombination(['shift', 'page_up'])
ks.sendCombination(['shift', 'page_down'])
ks.sendCombination(['shift', 'end'])
ks.sendCombination(['shift', 'home'])
ks.sendCombination(['shift', 'control', 'left'])
ks.sendCombination(['shift', 'control', 'right'])

For example for ks.sendCombination(['shift', 'left']) it emulates only single left. For ks.sendCombination(['shift', 'control', 'left']) - emulates only ctrl+left.

However sendCombination(['shift', 'a']) is working and produces A.

Windows 7
Node.js v10.15.3
node-key-sender: v1.0.11

node-key-sender not installing

Sorry if I'm just thick but I have tried installing this but it won't show any new node in the palette.
Tried:
~/.node-red $ npm install --save-dev node-key-sender
~/.node-red $ npm install -g --save-dev node-key-sender
~/.node-red $ npm i -g node-key-sender
~/.node-red $ npm i node-key-sender
~/.node-red $ sudo npm install --save-dev node-key-sender
~/.node-red $ sudo npm install -g --save-dev node-key-sender
~/.node-red $ sudo npm i node-key-sender
~/.node-red $ sudo npm i -g node-key-sender
But doesn't appear in node-red palette.
Any advice would be appreciated.
Robert
should have mentioned on fresh pi3 install with everything updated

Thank you awesome plugin! But found a little problem

Hey first off all thank you for this script it´s the only thing that worked for me and I can now press keys on windows while using node.js <3 Thank you so much!

But if your folder structure is as example C:\xampp\htdocs\sample test\start.js

It will not work because of the space at sample test
However no big deal :) But maybe you can fix it in the future

Press and hold key

Is there a way to press and hold a key? I was planning on triggering WASD to move a character in a game but need the key to be held down for a given duration.

"meta" key does not work

After some tests, I noticed that the "Windows" key does not accept "click".
I try with var ks = require('node-key-sender'); ks.sendCombination(['x', 'meta']); and 'x' works, but meta not. and without combination, meta also does not work :/

Unable to access jarfile

When I try to send the enter key in the following way:

var ks = require('node-key-sender');
ks.sendKey('return');

I get this error: (node:12148) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 58): Error: Command failed: java -jar 'C:\Users\Delo\Desktop\BitBot\node_modules\node-key-sender\jar\key-sender.jar' return
Error: Unable to access jarfile 'C:\Users\Delo\Desktop\BitBot\node_modules\node-key-sender\jar\key-sender.jar'

Not working outside electronJs

We have an electronJs application, running in all Operating systems (windows, macOS, ubuntu and fedora)
we are using node-key-sender to trigger "control+v" and paste text into other applications on the system.
the feature is working in all systems except fedora. node-key-sender work fine on our electronJs application, it paste text there, but once we put the cursor in another applications, node-key-sender does not work. text is not pasted there, and there's no error in the application.
There's an exception, which is Chrome, our application work fine with chrome, it paste text without any issues there.
other than chrome we tried most text editors and firefox, but didn't work with any of them.
does anyone know what's the problem in our system and how to fix it?

we are using fedora 33 and 32, electronJs v11, nodeJs v15.
we have installed fedora in virtualbox and physical machines. but in vain.

node-key-sender doesn't work after build in electron application

I have used node-key-sender in electron application. It works fine in development, but when I bundled it as a debian package and installed in another ubuntu system, It doesn't work. I throws some warnings.

Error: Command failed: java -jar key-sender.jar H e i g h t shift-@59 8 @9 4 period 8 @9 0 @9 0 period 0 4 o z @9 0 @9 0 period 4 9
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.394: Unable to locate theme engine in module_path: "adwaita",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.394: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.395: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.396: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.397: Unable to locate theme engine in module_path: "pixmap",
[electron]
[electron] (java:35173): Gtk-WARNING **: 11:08:35.398: Unable to locate theme engine in module_path: "adwaita",
[electron] java: symbol lookup error: /snap/core20/current/lib/x86_64-linux-gnu/libpthread.so.0: undefined symbol: __libc_pthread_init, version GLIBC_PRIVATE

Works in development mode, but not on production in electron

Hey,
I have the problem, that node-key-sender still works, if electron starts in production mode.
But if I package Electron and install my Electron App, node-key-sender stops to work :(

In my case, I throw ctrl + c on a selected text

const ks = require('node-key-sender');
...
ks.sendCombination(['control', 'c']);

Thanks for your help! :)

Node-Red integration (require)

Hi there,
I have to admit I'm a total newbie to node-red and I couldn't find a way to get node-key-sender into my nodes.
Since "require" doesn't work there are a few mentions to https://nodered.org/docs/writing-functions.html

But since I'm totaly new to node-red and programming in general... I don't now what to do.
Do you know how to "import" your node-key-sender into node-red?

Thanks in advance!
Sincerely Matthias

Java 7

This does not work with Java 7. Maybe add minimum requirement.

Windows combination "Windows + L" not working

I'm writing an application wich detects my presence. If i'm not near my computer, it should lock it automatically.

Currently the combination for Windows + L is not working (properly) in Windows 10. Any other combination like Windows + D is working perfectly. The only combination that is not working is the combination mentioned.

Current code:
keySender.sendCombination(["windows", "l"]).then(() => console.log('combination sent.'));

also tried uppercase L wich isn't working either. Is there a way to make this combination work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.