diff options
Diffstat (limited to 'robot/robot.sh')
| -rw-r--r-- | robot/robot.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/robot/robot.sh b/robot/robot.sh new file mode 100644 index 0000000..e013308 --- /dev/null +++ b/robot/robot.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +## call find_bot to init this +window_id= + +## This is the small sleep between key presses. Change for debugging +## when you are not sure what is happening +small_sleep=0.25 +big_sleep=1 + +function sleep_small { + sleep $small_sleep +} + +function sleep_big { + sleep $big_sleep +} + +function send_answer { + retn + sleep_small + key 5 + sleep_small +} + +function launch_emacs { + echo Launching $EMACS -Q -l $1 & + $EMACS -Q -l $1 & +} + +function kill_emacs { + key alt+x + command kill-emacs + retn +} + +function key { + xdotool key --window $window_id $1 +} + +function command { + xdotool type --window $window_id $1 +} + +function retn { + xdotool key --window $window_id Return +} + +function find_bot { + window_id=`xdotool search --name "emacs-bot"` + if [ -z "$window_id" ] + then + echo "Could not find window ID for Emacs-bot" + exit 1 + fi +} |
