Page 1 of 1

Using AHI.SendKeyEvent to hold down a key for a specific amount of time?

Posted: 27 Nov 2022, 16:28
by Anfly
Original forum : viewtopic.php?t=45307
A bit new to this, but from my understanding, AHI.SendKeyEvent(keyboardId, GetKeySC("1"), 1) is able to send "1", but I am having troubles figuring out how i can hold "1" for a specific amount of time without using Send. Here is a part of my code :

Code: Select all

#SingleInstance force
#Persistent
#include <AutoHotInterception>

time := 200

AHI := new AutoHotInterception()
keyboardId := AHI.GetKeyboardId(0x03F0, 0x0591)

AHI.SubscribeKey(keyboardId, GetKeySC(CurrentTap), false)
hotkey, w, function ;just a testing hotkey

return

function:
AHI.SendKeyEvent(keyboardId, GetKeySC(CurrentTap), 1)
;--- perhaps a code that loops AHI.SendKeyEvent? I need to make it hold for %time% amount
return
Thank you! If it is not possible, they I may just create a loop, but I am afraid it won't go as intended