工作上需要常常會用到滑鼠來關閉超過上百的分頁,用手點真的會點到手抽筋;身為一個合格的程式設計師,會偷懶是必要的技能,以前在用windows時代就有在用按鍵精靈,所以改用Ubuntu後當然也要來用一下,上網爬了一下好像是要裝 xdotool 這套件。
安裝 xdotool
apt install xdotool
取得目前滑鼠所在位置
xdotool getmouselocation
把滑鼠移到指定位置
xdotool mousemove x y
點擊滑鼠一下
xdotool click 1
click [1,2,3,4,5]
1 左鍵
2 滾輪
3 右鍵
4 向上滾
5 向下滾
組合指令 移到指定位置點擊一下
xdotool mousemove 84 56 click 1
//取得目前所有視窗名稱
xdotool search –title “” getwindowname %@
or
xdotool search . getwindowname %@
//取得 指定名稱 ID
xdotool search –name “xdotool.txt”
//把視窗焦點移到指定的ID
xdotool windowfocus 65011960
//把視窗焦點移到指定的ID 輸入 字串
xdotool windowfocus 65011960 type ‘hello’
//把視窗焦點移到指定的ID 複合鍵 存檔
xdotool windowfocus 65011960 key ctrl+s
//透過shell for 迴圈指令來實現滑鼠連點
for i in {1..100}; do xdotool mousemove 91 56 click 1;sleep 0.3;done
for i in {1..100}; 跑100次
do 執行指定的執令
sleep 要暫停多久 (0.01~999秒)
done 結束
好滋味御品/麻油猴頭菇
味丹 隨緣 鮮蔬百匯/素肉骨茶/素魷魚羹麵/韓式泡菜/麻辣燙湯麵 (5包/袋) 素食 全素 泡麵
垃圾桶 家用 客廳 臥室 辦公室 衛生間 大容量 高顏值 創意 收納 垃圾
義美e家小館-素食炒飯270g/包