このチュートリアルでは、Bashを使用してLinux - デスクトップを制御する方法を紹介します。Bashロボットに必要なパッケージは以下の通りです。
$ apt-get install xdotool xclip
#!/bin/bash
#mouse bewegen
xdotool mousemove 100 200
#Mouse - Koordinaten erfassen
xdotool getmouselocation
#Mouse-klick
xdotool click 1
Mouse-Klick auf Koordinaten
xdotool mousemove 100 200 click 1
#usw...
次の例では、Firefoxのウィンドウを検索して、Ubuntuのアドレスで新しいタブを開いています。
WID=$(xdotool search firefox | head -n1) ## Window-ID von Firefox ermitteln
xdotool windowactivate $WID
xdotool key "ctrl+t" ## neuen Reiter öffnen
xdotool key "ctrl+l" ## Fokussieren der Adressleiste
xdotool type --delay 100 "ubuntuusers.de" ## Internetadresse eintippen
xdotool key "Return" ## Internetadresse aufrufen
なぜxclipが必要なのか?
xdotools/“ctrl c “でキャッシュに内容をコピーし、bashスクリプトのxclipで読み込んだり処理したりすることができます。