Create a file was called test.sh.
Copy the follow article to test.sh
Execute the script like "sh test.sh &".
& mean put the command into the background.
###### Catch Original Windows ID ######
WID_Original=`xdotool getactivewindow`
## Back to original window
xdotool windowactivate $WID_Original
sleep 0.1
###### Open Local ######
xdotool type "gnome-terminal --title='Local' --geometry=70x40+1230+15"
sleep 0.2
xdotool key 'Return'
sleep 0.2
WID=`xdotool search --onlyvisible --title "local"`
xdotool windowactivate $WID
sleep 0.1
xdotool type "/home/happy/Downloads/iperf-2.0.5/src/iperf -s"
xdotool key 'Return'
sleep 0.1
###### Back to original window ######
xdotool windowactivate $WID_Original
sleep 0.1
###### Connect Remote ######
xdotool type "gnome-terminal --title='Remote' --geometry=70x40+1960+15"
sleep 0.2
xdotool key 'Return'
sleep 0.2
WID1=`xdotool search --onlyvisible --title "Remote"`
xdotool windowactivate $WID1
sleep 0.1
xdotool type "ssh 111.2.1.76 -l root"
xdotool key 'Return'
sleep 15
###### Type Command to Remote ######
xdotool type "cd /home/happy123/iperf-2.0.5/src/"
xdotool key 'Return'
sleep 0.1
xdotool type "./iperf -c 111.2.1.29 -i 10 -t 60"
xdotool key 'Return'
sleep 0.1
Reference :
- xdotool-fake-keyboardmouse-input-tool
- xdotool - command-line X11 automation tool
- xdotool: Script your mouse
- AUTOMATING UBUNTU DESKTOP WITH XDOTOOL
- Specifying X windows' geometry in the coordinates obtained from wmctrl
0 意見:
張貼留言