Node-Virtualization / node-virtualbox

A JavaScript Library for Interacting with VirtualBox
MIT License
259 stars 68 forks source link

Update keyboardputscancode example in README #42

Closed Stylizit closed 5 years ago

Stylizit commented 7 years ago

The documentation defines the usage of keyboardputscancode as such:

var sequence = [
  { key: 'SHIFT', type: 'make',  code: SCAN_CODES['SHIFT']},
  { key: 'A',     type: 'make',  code: SCAN_CODES['A']},
  { key: 'SHIFT', type: 'break', code: SCAN_CODES.getBreakCode('SHIFT')},
  { key: 'A',     type: 'break', code: SCAN_CODES.getBreakCode('A')}
];
virtualbox.keyboardputscancode("machine_name", sequence, function keyscan_callback(err) {
    if (error) throw error;
    console.log('Sent SHIFT A');
});

But it throws an error:

VBoxManage: error: Error '[object' is not a hex byte!

To reflect the way scan-codes.js works, I think the example should be instead:

var sequence = [
  SCAN_CODES['SHIFT'][0],
  SCAN_CODES['A'][0],
  SCAN_CODES.getBreakCode('SHIFT')[0],
  SCAN_CODES.getBreakCode('A')[0]
];
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not received any attention in 90 days. It will be closed in 14 days if no further activity occurs. Thank you for your contribution! (I'm a bot.)

stale[bot] commented 5 years ago

This issue has been automatically closed due to inactivity. (I'm a bot.)