summaryrefslogtreecommitdiff
path: root/wordmeasure
blob: e3b16a90e264e6af7c9ad6dda07576e3fa9aa169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/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