我使用的是Ubuntu 12.04.对于我的一个应用程序,我需要使用脚本在软件中控制鼠标.
我知道鼠标设备是/dev/input/mice
.如果我做一个cat /dev/input/mice
,然后移动鼠标,我会看到很多输出被转储到屏幕上.
现在,我想删除鼠标,并有一个脚本写入/dev/input/mice
,以控制鼠标指针
请帮助我执行以下命令:
请注意,我正在寻找一个shell脚本解决方案,而不是C/C++解决方案.
我使用的是Ubuntu 12.04.对于我的一个应用程序,我需要使用脚本在软件中控制鼠标.
我知道鼠标设备是/dev/input/mice
.如果我做一个cat /dev/input/mice
,然后移动鼠标,我会看到很多输出被转储到屏幕上.
现在,我想删除鼠标,并有一个脚本写入/dev/input/mice
,以控制鼠标指针
请帮助我执行以下命令:
请注意,我正在寻找一个shell脚本解决方案,而不是C/C++解决方案.
这并不是通过你提到的文件,但它可以更快地使用这个工具,而不是取消文件的转储.在bash中,它可以做你想做的一切.
xdotool does the trick in my terminal.
this is the package site for ubuntu.
you probably can install it trough
# apt-get install xdotool
I could just emerge it on gentoo without adding any repositories.
the tool works fairly simple:
#! /bin/bash
# move the mouse x y
xdotool mousemove 1800 500
# left click
xdotool click 1
# right click
xdotool click 3