Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
How to trigger keyboard function key programatically, detectable by background running exe file?

I have an exe file which can detect F6 key whenever i press in browser. But i want to do this task programatically in javascript. I have tried different methods from stackoverflow but none of them is detectable by exe file. But when i press F6 key manually then exe file detects.

These are the methods i have tried but none of them worked for me:

Javascript - trigger specific keyboard keys

Is it possible to simulate key press events programmatically?

etc.

After this automatic trigger, exe file return F7 key and i have to detect it in browser using javascript.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

This is done with nodejs by using https://www.npmjs.com/package/node-key-sender

node-key-sender is good to trigger keyboard keys automatically, see the code below

const http = require('http');
var ks = require('node-key-sender');
const requestListener = function (req, res) {
  res.writeHead(200);
  res.end('Server is running under 9999 port');

  ks.sendKey('F6');
}
const server = http.createServer(requestListener);
server.listen(9999);

In response, i can detect any key trigger by https://www.npmjs.com/package/iohook

Finally my code is:

const http = require('http');
var ks = require('node-key-sender');
const ioHook = require('iohook');

const requestListener = function (req, res) {
  res.writeHead(200);
  res.end('Server is running under 9999 port');

  ioHook.on("keydown", event => {
      console.log(event);
      // {keychar: 'f', keycode: 19, rawcode: 15, type: 'keypress'}
    });
    ioHook.start();

  ks.sendKey('F6');
}

const server = http.createServer(requestListener);
server.listen(9999);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!