I’m trying to emulate a key press (“r” for example) inside a plugin.
I was testing with:
import PluginBase from ‘chrome-extension://lnnmjmalakahagblkkcnjkoaihlfglon/dist/modules/plugin-base.js’;
import ExtensionUtil from ‘chrome-extension://lnnmjmalakahagblkkcnjkoaihlfglon/dist/modules/extension-util.js’;
function backendPressKey(codes){const codesArr=[].concat(codes);chrome.runtime.sendMessage({type:“pressKeys”,payload:{codes:codesArr,nonChar:!0}});}
function pressKey(key,code=0){return backendPressKey(code),!0}
var …
commands:[
{name:“SC41”,description:“bla bla bla”,match:“hi”,fn:()=>{alert(“in”);pressKey(0,76);alert(“end”)}}
]
…
but it doesn’t work.
Thank you in advance for your help!!