#!/bin/bash # This controls what steps to run do_walk=1 do_typing=1 do_smile=1 do_record=1 do_scroll=1 record_fps=30 record_quality=63 CLICKAT=./clickat CMD="bash -c" function echo_jiffies() { $CMD bash << "EOF" xpid=`ps -C Xorg,Xtightvnc -o pid,args | grep ':3' | sed 's/^ *//' | cut -f 1 -d ' '`; jiffs=`cat /proc/$xpid/stat | cut -f 14,15,16,17 -d ' '`; echo Jiffies $jiffs EOF } wid=0 xoffset=0 yoffset=0 fname=master if [ $# -gt 0 ] ; then if [ "$1" == "spice display 0" ] ; then xoffset=0 yoffset=59 fname=spicegtk fi if [ "$1" == "TightVNC: jwhite's X desktop (spice1:3)" ] ; then xoffset=0 yoffset=0 fname=vnc fi if [ "$1" == "SPICEc:0" ] ; then xoffset=0 yoffset=0 fname=spicec fi if [ "$1" == "Spice Javascript client - Google Chrome" ] ; then xoffset=24 yoffset=122 fname=spicejs fi wid=`$CLICKAT find --timeout 1 --window "$1"` if [ $? -ne 0 ] ; then echo "Could not find window $1" exit 1 fi CLICKAT="$CLICKAT --wid $wid --noprint" if [ $# -gt 1 ] ; then CMD="ssh $2" fi fi $CMD /sbin/ifconfig > $fname.ifconfig date >> $fname.ifconfig echo_jiffies >> $fname.ifconfig if [ $do_record -eq 1 ] ; then recordmydesktop --windowid $wid -x $xoffset -y $((yoffset+4)) --width 800 --height 592 --no-sound --overwrite --fps $record_fps --v_quality $record_quality --output $fname.ogv & # Skipping out on --full-shots record_pid=$! fi echo Beginning in 3 seconds sleep 3 $CLICKAT restore if [ $do_walk -eq 1 ] ; then # Walk over the ms office areas echo Hover over menu choices $CLICKAT move --timed --timeout 100 --position $((24+xoffset))x$((63+yoffset)) $CLICKAT move --timed --timeout 2000 --position $((25+xoffset))x$((63+yoffset)) $CLICKAT move --timed --timeout 500 --position $((80+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((132+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((204+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((291+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((377+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((441+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((501+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 500 --position $((561+xoffset))x$((77+yoffset)) $CLICKAT move --timed --timeout 2500 --position $((98+xoffset))x$((147+yoffset)) $CLICKAT move --timed --timeout 2500 --position $((293+xoffset))x$((147+yoffset)) $CLICKAT move --timed --timeout 100 --position $((630+xoffset))x$((584+yoffset)) $CLICKAT move --timed --timeout 1500 --position $((631+xoffset))x$((584+yoffset)) sleep 1 fi if [ $do_typing -eq 1 ] ; then sleep 1 echo Type for a while # Type a paragraph at ~ 120 wps $CLICKAT key --delay-between-keystrokes 100 --keystroke "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat." ./msleep 1000 fi if [ $do_smile -eq 1 ] ; then # Open a drawing echo Opening a drawing, wait for it to be ready $CLICKAT click --position $((136+xoffset))x$((76+yoffset)) ./msleep 100 $CLICKAT click --position $((284+xoffset))x$((104+yoffset)) ./msleep 100 $CLICKAT key --delay-between-keystrokes 100 --keystroke 'n' ./msleep 1000 $CLICKAT click --position $((739+xoffset))x$((132+yoffset)) ./msleep 1000 $CLICKAT click --position $((739+xoffset))x$((230+yoffset)) ./msleep 1000 # We repeat the click; not entirely sure why we need to do this. $CLICKAT click --position $((739+xoffset))x$((230+yoffset)) ./msleep 1000 $CLICKAT key --delay-between-keystrokes 200 --keystroke '4\r' ./msleep 1000 # Draw a smile echo Draw a smile $CLICKAT click --position $((23+xoffset))x$((143+yoffset)) ./msleep 100 radius=100 centerx=235 centery=370 startx=170 endx=300 starty=440 x=$startx $CLICKAT click --timed --timeout 100 --position $((x+xoffset))x$(($starty+yoffset)) --noup while [ $x -le $endx ] ; do x=$((x+5)) if [ $x -ge $centerx ] ; then a=$((x-centerx)) fi if [ $x -lt $centerx ] ; then a=$((centerx - x)) fi b=`echo "sqrt(($radius*$radius)-($a*$a))" | bc` $CLICKAT move --position $((x+xoffset))x$((centery+b+yoffset)) ./msleep 10 done $CLICKAT click --position $((endx+xoffset))x$((starty+yoffset)) --nodown ./msleep 1000 $CLICKAT click --position $((103+xoffset))x$((103+yoffset)) ./msleep 100 $CLICKAT click --delay 50 --position $((165+xoffset))x$((320+yoffset)) --dragto $((185+xoffset))x$((340+yoffset)) ./msleep 100 $CLICKAT click --position $((103+xoffset))x$((103+yoffset)) ./msleep 100 $CLICKAT click --delay 50 --position $((280+xoffset))x$((320+yoffset)) --dragto $((300+xoffset))x$((340+yoffset)) ./msleep 100 $CLICKAT key --delay-between-keystrokes 100 --keystroke "\e" ./msleep 100 $CLICKAT key --delay-between-keystrokes 100 --keystroke '\c+\[End]\c-' ./msleep 1000 fi if [ $do_typing -eq 1 -a $do_smile -eq 1 ] ; then echo Add more text # Add some more text $CLICKAT key --delay-between-keystrokes 100 --keystroke "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi" $CLICKAT key --delay-between-keystrokes 100 --keystroke "\r" $CLICKAT key --delay-between-keystrokes 100 --keystroke "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi" $CLICKAT key --delay-between-keystrokes 100 --keystroke "\r" fi if [ $do_scroll -eq 1 ] ; then echo Scroll up and then back down # Scroll up and then back down $CLICKAT button4 --repeat 50 --timeout 2000 --timed --position $((400+xoffset))x$((300+yoffset)) $CLICKAT button5 --repeat 50 --timeout 2000 --timed --position $((400+xoffset))x$((300+yoffset)) fi echo ... done $CMD /sbin/ifconfig >> $fname.ifconfig date >> $fname.ifconfig echo_jiffies >> $fname.ifconfig if [ $do_record -eq 1 ] ; then kill -s INT $record_pid fi