单击并沿给定方向拖动一个像素



我正在寻找一个脚本,该脚本将单击并按住鼠标右键,然后每"x"或 2 秒向给定方向拖动 1 个像素。我可以通过点击相应的方向键或手动调整脚本来告诉向给定方向移动的东西。

谢谢!

不完全确定你想要什么,但试试这个:

CoordMode, Pixel, Screen
direction = left
secondsBetweenMoves = 0.1
F1:: ;F1 to start it
    SendInput, {LButton Down}
    SetTimer, Move, %secondsBetweenMoves%
Return
F2:: ;F2 to end it
    SendInput, {LButton Up}
    SetTimer, Move, Off
Return
Move:
    MouseGetPos, mouseX, mouseY
    If (direction = "left") {
        MouseMove, mouseX-1, mouseY
    }
    Else If (direction = "right") {
        MouseMove, mouseX+1, mouseY
    }
    Else If (direction = "up") {
        MouseMove, mouseX, mouseY-1
    }
    Else If (direction = "down") {
        MouseMove, mouseX, mouseY+1
    }
Return

send event 命令可能会让你的生活更轻松。例如,您尝试在简单的无限循环中执行的操作:

coordmode, mouse, screen
setmousedelay, 0        # This makes the mouse move extremely fast
loop {
    mousegetpos, mx, my
    mx := mx+1
    sendevent {click, r, down}
    sendevent {click, %mx%, %my%, r, up}
    sleep 2000
}

此循环将按住右按钮,每两秒向右移动一个像素。如果您希望它向左移动,请更改

mx := mx+1

mx := mx-1

让它向上或向下移动是相同的机制,但添加或减少变量"my"。

这个循环可以做成一个计时器,用热键来启用或禁用它。

最新更新