16

我正在尝试通过命令脚本找出如何将鼠标光标 N 像素移动到某个方向......,因为我无法在我的计算机上安装任何东西。

我基本上试图让屏幕永远保持活跃,直到我杀死脚本。

(是的,我一直在寻找一种通过命令脚本来完成它的方法......但找不到任何东西。我希望它是可能的。)

4

5 回答 5

24

使用批处理文件操作鼠标的最直接方法是使用

rundll32 user32.dll,SetCursorPos

但这不是很有用 - 只是将鼠标设置为 0,0 位置。

检查mouse.bat - 它是一个自编译的 C#/批处理文件,不需要外部工具,源代码可见且可编辑。

例子:

//clicks at the current position
call mouse click

//double clicks at the current position
call mouse doubleClick

//right clicks at the current position
call mouse rightClick

//returns the position of the cursor
call mouse position

//scrolls up the mouse wheel with 1500 units
call mouse scrollUp 150

//scrolls down with 100 postitions
call mouse scrollDown 100

 //relatively(from the current position) moves the mouse with 100 horizontal and 100 vertial postitions
call mouse moveBy 100x100

//absolute positioning
call mouse moveTo 100x100

//relative drag (lefclick and move)
call mouse dragBy 300x200

//absolute drag
call mouse dragTo 500x500
于 2016-03-18T22:42:39.043 回答
15

搜索NirCmd并将其安装在C:\windows中,然后执行以下操作:

nircmd setcursor 100 50
nircmd movecursor 10 10

或其他点击命令等。

于 2013-11-28T01:15:52.100 回答
4

(迟到的答案,但对其他人仍然有用)如果您只是想让您的计算机不入睡,“咖啡因”软件可以很好地做到这一点。

于 2018-12-13T19:53:11.290 回答
1

您可以尝试安装 AutoHotKey。它使控制鼠标非常简单。示例脚本:

#MaxThreadsPerHotkey 3

^g::
Toggle := !Toggle
Loop
{
    If (!Toggle)
        Break
    Click
    Sleep 1000 ; Make this number higher for slower clicks, lower for faster.
}
Return

运行此示例的脚本后,按 control+g,它将每秒单击一次以保持屏幕唤醒。ctrl+g 再次停止。

安装在:https ://www.autohotkey.com/

找到解决方案:https ://autohotkey.com/boards/viewtopic.php?t=19846

于 2020-05-21T13:05:25.200 回答
-1

尝试将睡眠模式设置为“无”,但如果您想移动鼠标甚至不触摸它,请下载 memz clean 并让“随机光标移动”变蓝。现在享受。(如果它不起作用,则必须禁用有效负载。尝试使用 shift+esc 启用/禁用有效负载。尝试使用 ctrl+shift+s 跳过一些时间,因为在几分钟内鼠标会抖动得更好。)

于 2021-02-03T04:36:52.317 回答