I'm trying to give me logitech mouse an order using lua script that when the primary key is pressed a key in the keyboard is also clicked until I stop holding the mouse button
I tried this one but it works perfectly with all the mouse buttons but no actions happens when I set it up for the primary key.
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 1 then
PressKey("V")
end
if event == "MOUSE_BUTTON_RELEASED" and arg == 1 then
ReleaseKey("V")
end
end
any help?
Thanks in Advance.
By default primary mouse button events are disabled.
You need to enable them explicitly.
local v_pressed
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsKeyLockOn("scrolllock") then
PressKey("V")
v_pressed = true
elseif event == "MOUSE_BUTTON_RELEASED" and arg == 1 and v_pressed then
ReleaseKey("V")
end
end
UPDATE
The script works only when ScrollLock LED is on.