在Ubuntu中模拟鼠标移动 [英] Simulate mouse movement in Ubuntu
本文介绍了在Ubuntu中模拟鼠标移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问题
我希望使用外部脚本从命令行自动移动鼠标光标和模拟鼠标按钮。不寻找:
- 记录鼠标移动和播放(例如xnee,xmacro)
- 立即将鼠标从一个位置移动到另一个位置(例如xdotool,Python的warp_pointer)
理想解决方案 / p>
我想做的是:
- 脚本文件(例如
mouse-script.txt
)。 - 添加坐标,移动速度,延迟和按钮点击。例如:
(x,y,rate)=(500,500,50)
sleep = 5
click = left
- 运行脚本:
xsim<
- Record mouse movement and playback (e.g., xnee, xmacro)
- Instantly move the mouse from one location to another (e.g., xdotool, Python's warp_pointer)
- Edit a simple script file (e.g.,
mouse-script.txt
). - Add a list of coordinates, movement speeds, delays, and button clicks. For example:
(x, y, rate) = (500, 500, 50) sleep = 5 click = left
- Run the script:
xsim < mouse-script.txt
. - Download
xaut
for Python - Follow the
README
instructions - Run:
sudo apt-get install swig x11proto-xext-dev libx11-dev libxtst-dev cd /usr/local/src tar zxf xaut-0.2.0.tar.gz ./configure
- Edit
src/Makefile
- Change the
CFLAGS
line as follows:CFLAGS = -Wall -fPIC -fno-stack-protector
- Run:
make
- Copy
/usr/local/src/xaut-0.2.0/python/build/lib/*
to a new directory. - Change to that new directory.
- Copy and paste the following script into
mm.py
:import xaut mouse = xaut.mouse() delay mouse.move_delay( 100 ) mouse.move( 500, 500 )
- Run the script:
python mm.py
如何自动化鼠标移动,以便以特定速度从其当前位置转换到屏幕上的另一个位置?例如:
xdotool mousemove 500 500 --rate 50
- 率50
不存在与 xdotool
。
解决方案
Problem
Am looking to automatically move the mouse cursor and simulate mouse button clicks from the command-line using an external script. Am not looking to:
Ideal Solution
What I'd like to do is the following:
Question
How do you automate mouse movement so that it transitions from its current location to another spot on the screen, at a specific velocity? For example:
xdotool mousemove 500 500 --rate 50
The --rate 50
doesn't exist with xdotool
.
解决方案
这篇关于在Ubuntu中模拟鼠标移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文