Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Steals focus from the app on OS X 10.14.3 #25

Open
cboileau opened this issue Apr 11, 2019 · 4 comments
Open

Steals focus from the app on OS X 10.14.3 #25

cboileau opened this issue Apr 11, 2019 · 4 comments

Comments

@cboileau
Copy link

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.

@ordinov
Copy link

ordinov commented May 20, 2020

just add -Dapple.awt.UIElement=true where the package executes the jar file

it works in background on OS X

@ordinov
Copy link

ordinov commented May 20, 2020

#35

@mlrv
Copy link

mlrv commented Dec 23, 2020

For anyone interested in this issue, I've taken the liberty to fork this project and incorporate @ordinov's fix as a standalone package, you can find it here.

I needed something like this for a separate library, and this project doesn't seem to be actively maintained anymore.

@coda-nsit
Copy link

@mlrv I have a text file open and I run your forked library.

var nodeKeySimulator = require('node-keys-simulator');

nodeKeySimulator.sendKey('a');
nodeKeySimulator.sendKey('a');
nodeKeySimulator.sendKey('a');
nodeKeySimulator.sendKey('a');
nodeKeySimulator.sendKey('a');
nodeKeySimulator.sendKey('a');

nodeKeySimulator.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', stdout);
        },        
        function(error, stdout, stderr) {
            console.log('error', error, stdout, stderr);
        }
    );

Now the java icons don't appear but the program just silently exits without anything getting printed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants