I was trying to create a script for two different actions on the same button for single press and hold.
Now I use this script.
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %s\n", event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 10) then
timeStart = GetRunningTime()
elseif (event == "MOUSE_BUTTON_RELEASED" and arg == 10) then
--Measure time elapsed since button_pressed event.
elapsed = GetRunningTime() - timeStart
OutputLogMessage("held for %dms\n",elapsed)
if (elapsed >= 200) then
PressKey("lgui")
PressAndReleaseKey("V")
ReleaseKey("lgui")
elseif (elapsed < 200) then
PressKey("lctrl")
PressAndReleaseKey("V")
ReleaseKey("lctrl")
end
end
end
But second action (Win+V) occurs only after #10 button is released.
What should be in the script so that the second combination (Win + V) occurs automatically after 200 milliseconds, without having to release the button?