记录一下,
windows用autohotkeys
crtl + 方向键 / 空格 :移动鼠标 / 鼠标左击
crtl + shift + 方向键 / 空格: 快速移动鼠标 / 鼠标右击
^up::MouseMove,0,-75,0,r
^+up::MouseMove,0,-15,0,r
^down::MouseMove,0,75,0,r
^+down::MouseMove,0,15,0,r
^left::mousemove,-75,0,0,r
^+left::mousemove,-15,0,0,r
^right::mousemove,75,0,0,r
^+right::mousemove,15,0,0,r
^space::MouseClick, left
^+space::MouseClick, right
mac(更新一下,换了个带小键盘的键盘,直接用系统的鼠标键功能。。。深井冰>-<)。 文章来源:https://www.toymoban.com/news/detail-585612.html
用hammerspoon ,这个还没做好,无法长按实现持续移动,鼠标点击也还没做,先用着文章来源地址https://www.toymoban.com/news/detail-585612.html
-- alt + 方向键 :移动鼠标 --
-- alt + cmd + 方向键:快速移动鼠标 --
-- alt + space :鼠标左击 --
local screens = hs.screen.allScreens()
function moveleft()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"]-100, y=cs["y"] + 0}, screens[1])
end
function moveleft_accurate()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"]-10, y=cs["y"] + 0}, screens[1])
end
function moveright()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"]+100, y=cs["y"] + 0}, screens[1])
end
function moveright_accurate()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"]+10, y=cs["y"] + 0}, screens[1])
end
function moveup()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"], y=cs["y"]-100}, screens[1])
end
function moveup_accurate()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"], y=cs["y"]-10}, screens[1])
end
function movedown()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"], y=cs["y"]+100}, screens[1])
end
function movedown_accurate()
local cs = hs.mouse.getRelativePosition()
hs.mouse.setRelativePosition({x= cs["x"], y=cs["y"]+10}, screens[1])
end
function MouseleftClick()
local cs = hs.mouse.getRelativePosition()
hs.eventtap.leftClick(cs)
end
function MouseRightClick()
local cs = hs.mouse.getRelativePosition()
hs.eventtap.RightClick(cs)
end
hs.hotkey.bind({"alt"}, "Left", moveleft)
hs.hotkey.bind({"alt","cmd"}, "Left", moveleft_accurate)
hs.hotkey.bind({"alt"}, "Right", moveright)
hs.hotkey.bind({"alt","cmd"}, "Right", moveright_accurate)
hs.hotkey.bind({"alt"}, "Up", moveup)
hs.hotkey.bind({"alt","cmd"}, "Up", moveup_accurate)
hs.hotkey.bind({"alt"}, "Down", movedown)
hs.hotkey.bind({"alt","cmd"}, "Down", movedown_accurate)
hs.hotkey.bind({"alt"}, "Space", MouseleftClick)
到了这里,关于键盘控制鼠标移动的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!