-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathkeyboard
More file actions
executable file
·51 lines (45 loc) · 761 Bytes
/
keyboard
File metadata and controls
executable file
·51 lines (45 loc) · 761 Bytes
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
#!/bin/bash
. ./.keycodes
keycode() {
mode=$(( $2 + 1 ))
case $mode in
1)
code=$(eval echo \${$1})
;;
2)
code=$(eval echo \$KEYCODE_$1)
;;
3)
code=$(eval echo \$KEYCODE_DPAD_$1)
;;
*)
echo ""
return 1
;;
esac
# if [[ $code =~ ^-?[0-9]+$ && "$i" -lt "100" ]]; then
if [[ $code =~ ^-?[0-9]+$ ]]; then
echo $code
return 0
fi
echo $(keycode $1 $mode)
}
input() {
echo adb shell input $@
adb shell input $@
}
text=$@
# String.replace " ", "%s"
text=${text// /%s}
# String.split ";"
array=${text//;/ }
for i in $array; do
code=$(keycode $i)
if [ -z "$code" ]; then
echo "text\>$i"
input text "$i"
else
echo " key\>$code"
input keyevent $code
fi
done