summaryrefslogtreecommitdiff
path: root/limeasure
blob: c1dd8f2c704cf03eb3dfce3aafbfc6e0df31ddf1 (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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
#!/bin/bash

# This controls what steps to run
do_walk=1
do_smile=1
do_typing=1

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.ogv
if [ $# -gt 0 ] ; then
    if [ "$1" == "spice display 0" ] ; then
        xoffset=0
        yoffset=59
        fname=spicegtk.ogv
    fi

    if [ "$1" == "TightVNC: jwhite's X desktop (spice1:3)" ] ; then
        xoffset=0
        yoffset=0
        fname=x11vnc.ogv
    fi

    if [ "$1" == "SPICEc:0" ] ; then
        xoffset=0
        yoffset=0
        fname=spicec.ogv
    fi

    if [ "$1" == "Spice Javascript client - Google Chrome" ] ; then
        xoffset=24
        yoffset=122
        fname=spicejs.ogv
    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
recordmydesktop --windowid $wid -x $xoffset -y $((yoffset+4)) --width 800 --height 592 --no-sound --overwrite --full-shots --v_quality 0 --output $fname &
record_pid=$!

$CLICKAT restore
echo Begin...hover over each of 8 choices

if [ $do_walk -eq 1 ] ; then
# Walk through the opening Libre Office screen, testing mouse position, and hover text
$CLICKAT move --timed --timeout 500 --position $((225+xoffset))x$((245+yoffset))
$CLICKAT move --timed --timeout 500 --position $((225+xoffset))x$((295+yoffset))
$CLICKAT move --timed --timeout 500 --position $((225+xoffset))x$((345+yoffset))
$CLICKAT move --timed --timeout 500 --position $((225+xoffset))x$((420+yoffset))
$CLICKAT move --timed --timeout 500 --position $((525+xoffset))x$((245+yoffset))
$CLICKAT move --timed --timeout 500 --position $((525+xoffset))x$((295+yoffset))
$CLICKAT move --timed --timeout 500 --position $((525+xoffset))x$((345+yoffset))
$CLICKAT move --timed --timeout 500 --position $((525+xoffset))x$((420+yoffset))

echo  Hover over the 3 lower choices
$CLICKAT move --timed --timeout 1500 --position $((160+xoffset))x$((545+yoffset))
$CLICKAT move --timed --timeout 1500 --position $((190+xoffset))x$((545+yoffset))
$CLICKAT move --timed --timeout 1500 --position $((220+xoffset))x$((545+yoffset))
sleep 1
fi

if [ $do_smile -eq 1 ] ; then
# Open a drawing
echo  Opening a drawing, wait for it to be ready
$CLICKAT key --keystroke '\a+r\a-'
sleep 5

lo_button_y=560
# Draw a smile
echo  Draw a smile
$CLICKAT click --timed --timeout 100 --position $((180+xoffset))x$((lo_button_y+yoffset))
#$CLICKAT click --timed --timeout 100 --position $((375+xoffset))x$((445+yoffset))
radius=100
centerx=520
centery=280
x=440
$CLICKAT click --timed --timeout 100 --position $((440+xoffset))x$((340+yoffset)) --noup
while [ $x -le 600 ] ; 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 $((600+xoffset))x$((340+yoffset)) --nodown
./msleep 1000

$CLICKAT click --position $((124+xoffset))x$((lo_button_y+yoffset))
./msleep 100
$CLICKAT click --delay 50 --position $((460+xoffset))x$((240+yoffset)) --dragto $((500+xoffset))x$((280+yoffset))
./msleep 1000
$CLICKAT click --position $((124+xoffset))x$((lo_button_y+yoffset))
./msleep 100
$CLICKAT click --delay 50 --position $((540+xoffset))x$((240+yoffset)) --dragto $((580+xoffset))x$((280+yoffset))



# Export our smile
echo  Export the smile
$CMD rm -f /tmp/smile.png
$CLICKAT click --timed --timeout 100 --position $((10+xoffset))x$((37+yoffset))
$CLICKAT key --delay-between-keystrokes 100 --keystroke 't\r'
sleep 2
$CLICKAT key --keystroke '\a+n\a-'
sleep 1
$CLICKAT key --delay-between-keystrokes 100 --keystroke '/tmp/smile\t'
sleep 1
$CLICKAT key --delay-between-keystrokes 100 --keystroke 'pn\r'
sleep 6
$CLICKAT key --delay-between-keystrokes 100 --keystroke '2\[Delete]'
./msleep 500

lo_compression_y=347
lo_compression_x=384
$CLICKAT click --delay 50 --noup --position $((lo_compression_x+xoffset))x$((lo_compression_y+yoffset)) --dragto $((lo_compression_x-120+xoffset))x$((lo_compression_y+yoffset))
./msleep 2000
$CLICKAT click --delay 50 --nodown --dragto $((lo_compression_x+xoffset))x$((lo_compression_y+yoffset)) --position $((lo_compression_x-120+xoffset))x$((lo_compression_y+yoffset))
./msleep 100
$CLICKAT click --timed --timeout 100 --position $((396+xoffset))x$((530+yoffset))

# Close the drawing
echo  Close the drawing
$CLICKAT click --timed --timeout 100 --position $((10+xoffset))x$((37+yoffset))
$CLICKAT key --delay-between-keystrokes 100 --keystroke 'c'
sleep 4
$CLICKAT key --delay-between-keystrokes 100 --keystroke 'd'
fi

if [ $do_typing -eq 1 ] ; then
sleep 1

# Open a document
echo  Open a text document
$CLICKAT key --keystroke '\a+d\a-'
sleep 6

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."

echo  Insert the smile
$CLICKAT click --timed --timeout 100 --position $((129+xoffset))x$((37+yoffset))
$CLICKAT click --timed --timeout 100 --position $((241+xoffset))x$((460+yoffset))
$CLICKAT click --timed --timeout 100 --position $((406+xoffset))x$((460+yoffset))
sleep 3
$CLICKAT key --delay-between-keystrokes 100 --keystroke "/tmp/smile.png\r"
sleep 5
$CLICKAT key --delay-between-keystrokes 100 --keystroke "\e"
sleep 4

echo  Add more text
# Add some more text
$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"
$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"
$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"


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))

echo  Close the document
# Close the document
$CLICKAT click --timed --timeout 100 --position $((10+xoffset))x$((37+yoffset))
$CLICKAT key --delay-between-keystrokes 100 --keystroke 'c'
sleep 4
$CLICKAT key --delay-between-keystrokes 100 --keystroke 'd'
fi

echo  ... done
$CMD /sbin/ifconfig >> $fname.ifconfig
date >> $fname.ifconfig
echo_jiffies >> $fname.ifconfig

kill -s INT $record_pid