
open = false
---------------------------------------------------------------按下鼠标DPI按键和左ALT开关
function isOpen(event,arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6 and IsModifierPressed("lalt")) then
open = not open
if open then
OutputLogMessage("开启\n")
else
OutputLogMessage("关闭\n")
end
end
return open
end
---------------------------------------------------------------按下DPI按键获取当前鼠标坐标
function location(event,arg)
x, y = GetMousePosition();
OutputLogMessage("当前鼠标坐标:x=%d y=%d\n", x, y);
end
---------------------------------------------------------------将鼠标移动到屏幕中心
function gotoScreenCentral()
MoveMouseToVirtual (32767, 32767);
end
---------------------------------------------------------------将鼠标根据当前位置进行移动
function gotoScreenCentral()
MoveMouseRelative(100,0);
end
---------------------------------------------------------------按下一次鼠标左键
function gotoScreenCentral()
PressMouseButton(1)
end
---------------------------------------------------------------主函数
function OnEvent(event, arg)
if isOpen(event,arg) then
if (event == "MOUSE_BUTTON_PRESSED" and arg == 6 ) then
location(event,arg)
end
end
end
有个友友说想实现鼠标移动功能,这里提给出几个没有调用的函数作参考,另外实现按下鼠标DPI按键后获取当前鼠标位置坐标功能
注:DPI按键不是每个鼠标都有,没有的改成1-6慢慢试就行(鼠标左键不能触发GetMousePosition(),其他按键也有可能,得多试);
开启方法是同时按下鼠标DPI按键和左ALT,和上面提到的一样,没有DPI按键就一起改掉,在第4和第34行的数字6为DIP按键的按键码