大家好,我想用"capslock“关闭或打开,而不是按钮4和5来更改第一和第二段代码,并使用"numlock”激活和禁用脚本,如果有人可以帮助我,这是我的脚本:
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", 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)
如果可以的话请帮帮我。谢谢你!!
发布于 2022-06-22 07:11:09
您可以通过调用函数IsKeyLockOn
来确定锁键的当前状态。
function OnEvent(event, arg)
OutputLogMessage("event = %s, arg = %d\n", 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
https://stackoverflow.com/questions/72702184
复制相似问题