Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Script to record and replay device screen touches and key input

  • Loading branch information...
commit 900c29d97970c68df4b0dd6316a0fbe18567f57d 1 parent 571982e
@pelya authored
Showing with 29 additions and 1 deletion.
  1. +1 −1  project/jni/application/src
  2. +28 −0 recordUserInput.sh
View
2  project/jni/application/src
View
28 recordUserInput.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+#if [ -z "$1" ]; then echo "Record user touch/key input, and replay it back via script" ; echo "Usage: $0 ScriptName.sh" ; exit ; fi
+
+echo "#!/bin/sh"
+echo "# Record user touch/key input, and replay it back via script"
+echo "# Usage: $0 | tee ScriptName.sh ; chmod a+x ScriptName.sh ; ./ScriptName.sh"
+echo "# Press Ctrl-C when done"
+
+#convert_input() {
+#awk '{ if (($1 != "") && (substr($0,1,1)=="/")){ sub(":","",$1); printf("adb shell sendevent %s %d %d %d\n",$1,strtonum("0x"$2),strtonum("0x"$3),strtonum("0x"$4)); } }'
+#}
+
+CURTIME=0
+export CURTIME
+
+adb shell getevent | while read DEV N1 N2 N3; do
+ if echo "$DEV" | grep "^[/]" >/dev/null ; then
+ CURTIME1=`date +%s`
+ if [ "$CURTIME1" '!=' "$CURTIME" ] ; then [ "$CURTIME" = 0 ] || echo "sleep `expr $CURTIME1 - $CURTIME`" ; CURTIME=$CURTIME1 ; export CURTIME ; fi
+ DEV=`echo "$DEV" | sed 's/\(.*\)./\1/'`
+ N1=`printf '%d' 0x$N1`
+ N2=`printf '%d' 0x$N2`
+ N3=`echo $N3 | grep -o "[0-9a-fA-F]*"`
+ N3=`printf '%d' 0x$N3`
+ echo "adb shell sendevent $DEV $N1 $N2 $N3"
+ fi
+done
Please sign in to comment.
Something went wrong with that request. Please try again.