http://stackoverflow.com/questions/3474318/shell-batch-scripting-to-direct-commands-to-adb-shell
adb shell "sendevent /dev/input/event9 3 53 215;sendevent /dev/input/event9 3 54 68;sendevent /dev/input/event9 3 48 40;sendevent /dev/input/event9 3 50 6;sendevent /dev/input/event9 3 57 0;sendevent /dev/input/event9 0 2 0;sendevent /dev/input/event9 0 0 0;sendevent /dev/input/event9 3 53 215;sendevent /dev/input/event9 3 54 68;sendevent /dev/input/event9 3 48 0;sendevent /dev/input/event9 3 50 6;sendevent /dev/input/event9 3 57 0;sendevent /dev/input/event9 0 2 0;sendevent /dev/input/event9 0 0 0;"
The only thing you need to take care of is, that you do not feed in more than 25 (that's the amount I used, 30 doesn work anymore) sendevents, because else adb will throw the error, that there are too many arguments or so.
=========
adb shell "sendevent /dev/input/event0 3 0 281;
sendevent /dev/input/event0 3 1 70;
sendevent /dev/input/event0 1 330 1;
sendevent /dev/input/event0 0 0 0;
sendevent /dev/input/event0 1 330 0;
sendevent /dev/input/event0 0 0 0;
sendevent /dev/input/event0 1 330 1;
sendevent /dev/input/event0 0 0 0;
sendevent /dev/input/event0 1 330 0;
sendevent /dev/input/event0 0 0 0;
sendevent /dev/input/event0 0 0 0;
sendevent /dev/input/event0 0 0 0"
|
answered Sep 15 '11 at 16:14
|
|
|
|
=====
(
echo cd sdcard
echo ls
) | adb shell
So it may work as below:
(
echo am start -a android.intent.action.MAIN -n com.q.me.fui.activity/.InitActivity
echo sleep 15
echo sendevent /dev/input/event0 3 0 281
echo sendevent /dev/input/event0 3 1 70
echo sendevent /dev/input/event0 1 330 1
echo sendevent /dev/input/event0 0 0 0
echo sendevent /dev/input/event0 1 330 0
echo sendevent /dev/input/event0 0 0 0
echo sendevent /dev/input/event0 1 330 1
echo sendevent /dev/input/event0 0 0 0
echo sendevent /dev/input/event0 1 330 0
echo sendevent /dev/input/event0 0 0 0
echo sendevent /dev/input/event0 0 0 0
echo sendevent /dev/input/event0 0 0 0
echo sleep 5
echo input keyevent 82
echo input keyevent 20
echo input keyevent 20
echo input keyevent 22
echo input keyevent 22
echo input keyevent 22
echo input keyevent 66
echo sleep 5
) | adb shell