如何设置(numlock和capslock)打开logitech脚本



大家好我想用"capslock"Off或on代替按钮4和5来改变第一和第二个代码,并使用"numlock"要激活和停用脚本,如果有人可以帮助我,这是我的脚本:

function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %dn", event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "PROFILE_DEACTIVATED" then
ReleaseMouseButton(2) -- to prevent it from being stuck on
elseif event == "MOUSE_BUTTON_PRESSED" and (arg == 4 or arg == 5) then     
recoil = recoil ~= arg and arg
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil == 4 then
repeat
MoveMouseRelative(-2, 3)
Sleep(10)
MoveMouseRelative(2, -2)
Sleep(10)
until not IsMouseButtonPressed(1)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil == 5 then
repeat 
MoveMouseRelative(-10, 9)
Sleep(16)
MoveMouseRelative(10, -10)
Sleep(16)
until not IsMouseButtonPressed(1) 
end
end

我想设置numlock打开和关闭脚本。我想设置capslock何时关闭脚本使用这个:

repeat
MoveMouseRelative(-2, 3)
Sleep(10)
MoveMouseRelative(2, -2)
Sleep(10)
until not IsMouseButtonPressed(1)

和capslock在脚本上使用时:

repeat 
MoveMouseRelative(-10, 9)
Sleep(16)
MoveMouseRelative(10, -10)
Sleep(16)
until not IsMouseButtonPressed(1)
如果可以的话,请帮帮我。谢谢你! !

可以通过调用IsKeyLockOn:

函数来确定锁键的当前状态。
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %dn", event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and arg == 1 and IsMouseButtonPressed(3) and IsKeyLockOn"numlock" then
if not IsKeyLockOn"capslock" then
-- capslock is off 
repeat
MoveMouseRelative(-2, 3)
Sleep(10)
MoveMouseRelative(2, -2)
Sleep(10)
until not IsMouseButtonPressed(1)
else
-- capslock is on
repeat 
MoveMouseRelative(-10, 9)
Sleep(16)
MoveMouseRelative(10, -10)
Sleep(16)
until not IsMouseButtonPressed(1) 
end
end
end

最新更新