-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext_input.py
More file actions
27 lines (23 loc) · 954 Bytes
/
text_input.py
File metadata and controls
27 lines (23 loc) · 954 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
import sys
import os
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from android_scripts_python.library import main_functions
from android_scripts_python.library.device_operations import display_selected_device
def main():
if len(sys.argv) < 2:
main_functions.get_device_choice()
else:
main_functions.build_device_sn_array()
main_functions.deviceSerial = sys.argv[1]
display_selected_device(main_functions.deviceSerial)
while True:
yn = input(" Do you want to input text? [y/n] ").strip().lower()
if yn != 'y':
break
inputtext = input(" --> Enter the text you want to input : ")
# Escape spaces for adb input text
inputtext_escaped = inputtext.replace(' ', '%s')
main_functions.adb_shell(main_functions.deviceSerial, "shell", "input", "text", inputtext_escaped)
print("")
if __name__ == "__main__":
main()