Posted: Sat Apr 17, 2021 9:51 am Post subject: Hotkey on key press?
Hotkeys created with createHotkey() run over and over on an interval as long as the associated key is held.
I know I can change that interval but that's not good enough for me, what I need is a hotkey that will run exactly once for every single distinct press of the key, and I haven't been able to find how to achieve that.
Here's something hacky I've tried that kinda works, but I'd like a proper solution.
Code:
HotkeyDict = {}
function CustomHotkey(func, hotkey)
local timer = createTimer(MainForm, false)
timer.Interval = 20
timer.OnTimer = function(t)
if not isKeyPressed(hotkey) then
t.Enabled = false
end
end
HotkeyDict[hotkey] = timer
createHotkey(function()
if not HotkeyDict[hotkey].Enabled then
HotkeyDict[hotkey].Enabled = true
func()
end
end, hotkey)
end
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
Posted: Sat Apr 17, 2021 11:01 am Post subject:
next version (7.3) retriggers a hotkey if you release the hotkey before DelayBetweenActivate is reached and then pressed again. So if you set it to a very high interval it will act the way you wish _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum