Simple Push to Talk button.
Hi people. I need your help please. I've trying to make a simple holding button but it's not working and I've tried multiple combinations of events and key actions but I can't get it to work. I just need a button that while i hold, it hold "ctrl" pressed on the computer.
Here's my layout right now:
<?xml version="1.0" encoding="utf-8"?>
<button text="Push To Talk" onhold="ptt" />
And here is my remote.lua file:
local kb = libs.keyboard;
[email protected] Push To Talk
actions.ptt = function ()
So, what am I doing wrong here? I think i tried every single combination possible. Thanks for your help.
You need an 'onup' also in the button, that releases Control when you take your finger off the button, eg:
<?xml version="1.0" encoding="utf-8"?> <layout> <row> <button text="Push To Talk" onhold="ptt" onup="ptt2" /> </row> </layout>
Then in your remote file, 2 separate actions, one for kb.down and one for kb.up, eg:
[email protected] Push To Talk actions.ptt = function() kb.down("control"); end [email protected] Push To Talk actions.ptt2 = function() kb.up("control"); end
Just a disclaimer though, I noticed that my tablet takes half a second to implement the onhold event (not the same issue with the release)..
I couldn't get this to work for a while either, this helped (although note there is a typo; the documentation reads that ondown occurs when the button is released, and onup occurs when the button pressed is down, these explanations are swapped around).
No, still not working at all... :/ For some reason this remote is not sending anything to the computer I guess... And its not a connection problem because all other remotes are working fine!
Is there anything else in that remote.lua file? You could try adding an action/button to the same remote/layout that just presses a single key, eg:
[email protected] Push T Key actions.push_t_key = function() kb.stroke("t"); end
That way you can make sure there is not an issue with those specific files, ie. typo somewhere sneaky..
How are you testing? I tried the first suggestion in Notepad, using ctrl to cut/paste. Also EventGhost to see that ctrl key was being logged..