I have been trying to develop a POS solution and opening the Till Drawer has been the hardest part so far.
Currently I am trying to do this via a combination of keys. Ie CTRL+SHIFT+p. What I need to do is execute those keys when a certain function is called. I have built the system and also have the function ready and waiting.
I am using Auto hot Key to map these keys to an exe which opens the drawer. If I press the keys on my keyboard this works perfectly fine. But rather than having the user press these keys, I would like to execute them automatically. I have searched quite a bit and many solutions are listening for if a key is pressed and then reacting accordingly.
The current code I have found that has gotten me slightly forward is the following (this simulates the press of CTRL+SHITF+p from what I understand):
e = jQuery.Event("keypress")
e.which = 80; //choose the one you want
e.ctrlKey = true;
e.shiftKey = true;
$("#pos-paid").keypress(function(){alert('keypress triggered')}).trigger(e)
This does alert me that the key has been pressed. Jquery is definitely not my strong point so forgive me if the function is nonsense.
I am using Chrome and understand there are security issues to consider. Some people say this is impossible others say it is possible.
Can someone tell me if this is achievable and if so can someone point my in the right direction of how to achieve this or some similar questions/docs for this?
Notes I have currently tried creating an extension, had issues accessing local files.
I have tried creating an extension that communicates with an app, but also ran into issues.
I want to avoid any solutions that require networking.
I own the client machines that will access the site and therefore can prepare this and add any software necessary to achieve this.
Here are my other two questions for this issue.