1
当前鼠标光标的类型,我知道我可以通过执行“xdotool getmouselocation”获得鼠标光标的当前位置的方式。检测从bash或蟒蛇
我想检测当前鼠标光标的类型,如指针,梁,或从终端的bash或Python代码手光标。这可能吗?
谢谢。 月
当前鼠标光标的类型,我知道我可以通过执行“xdotool getmouselocation”获得鼠标光标的当前位置的方式。检测从bash或蟒蛇
我想检测当前鼠标光标的类型,如指针,梁,或从终端的bash或Python代码手光标。这可能吗?
谢谢。 月
您可以使用xdotool连续点击其中的链接是,直到程序注意到窗口标题的变化。当窗口标题改变时,这意味着链接已被点击,并且新页面正在加载。
点击功能:
ff_window=$(xdotool search --all --onlyvisible --pid "$(pgrep firefox)" --name ".+")
click-at-coords() {
title_before=$(xdotool getwindowname $ff_window)
while true; do
sleep 1
title_now=$(xdotool getwindowname $ff_window)
if [[ $title_now != $title_before]]; then
break
else
xdotool windowfocus --sync "$ff_window" mousemove --sync "$1" "$2" click 1
fi
done
}
假设你正在使用xdotool点击使用坐标:
# replace each x and y with the coordinates of each link
# example with 2 sets of coordinates: all_coords=("67 129" "811 364")
all_coords=("x y" "x y")
for sub in "${all_coords[@]}"; do
coords=($sub)
click-at-coords "${coords[@]}"
done
什么操作系统您使用的? – Nelson
如果您指的是光标所在的“状态”(将鼠标悬停在文本框或链接或桌面上时显示的不同光标),我觉得您可以更好地解释为什么要这样做。我可以提供一个更好的选择。 – Nelson
@Nelson我正在使用Xubuntu 17.04。 – user1350338