脚本用户输入
问题
你想远程控制一个程序,但不幸的是这个程序只有"点击&花哨"(*)界面。 (*) 好吧 - 只有图形用户界面(简称 GUI)。
解决方案
你可以使用 xdotool 来脚本化用户操作。要安装此工具,使用:
sudo apt-get install xdotool
现在你可以使用以下命令获取鼠标指针的位置:
xdotool getmouselocation
或通过以下方式设置:
xdotool mousemove 400 300(这意味着将鼠标设置为位置 x=400, y=300;原点是屏幕的左上角。)
要点击使用:
xdotool click 1
要输入文本(例如到 GUI 的控制字段中)
xdotool type 'Hello World'
(附:xdotool 有更多选项…安装此工具后,输入 man xdotool 查看所有选项。)
Check out similar posts by category:
Allgemein
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow