See [Benjamin_Loison/Backup_Android_apps/issues/81#issuecomment-10126176](https://codeberg.org/Benjamin_Loison/Backup_Android_apps/issues/81#issuecomment-10126176).
Is it possible to use scrcpy with a command line to type text?
Mistral:
Yes, scrcpy allows you to type text from the command line using the --clipboard or --shortcut options, but the most direct way is to use adb shell input text in combination with scrcpy.
How to Type Text via Command Line with scrcpy:
Enable ADB:
Ensure your Android device is connected via USB (or Wi-Fi) and adb is working:
adb devices
(You should see your device listed.)
Type Text:
Use adb shell input text to send text to your device:
adb shell input text "Hello, this is typed from the command line!"
This will type the text as if you were using the on-screen keyboard.
Note: This method does not work in all apps (e.g., some secure fields like passwords may block it).
Alternative: scrcpy + Clipboard:
If you want to paste text from your computer's clipboard:
scrcpy --clipboard
Copy text on your computer, then press Ctrl+V in scrcpy to paste it.
Shortcut for Special Keys:
Use scrcpy --shortcut to map keyboard shortcuts (e.g., Ctrl+C to copy, Ctrl+V to paste).
Example Workflow:
Open a text field on your Android device (e.g., in a notes app).
Run:
adb shell input text "This is a test."
The text will appear in the active field.
Limitations:
Some apps (e.g., banking apps) may block adb input for security.
Special characters or Unicode may require additional escaping.
Traceback (most recent call last):
File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 1205, in <module>
backupOrRestoreApp(PACKAGE_NAME)
File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 569, in backupOrRestoreApp
exec(getAppScript(PACKAGE_NAME))
File "<string>", line 140, in <module>
File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 361, in writeText
text = unidecode(text)
^^^^^^^^^^^^^^^
File "/home/CENSORED/venv/lib/python3.12/site-packages/unidecode/__init__.py", line 60, in unidecode_expect_ascii
bytestring = string.encode('ASCII')
^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'encode'
DuckDuckGo and Google search *scrcpy type command*.
https://chat.mistral.ai/chat/ec79efb8-30c3-439b-9186-159b76877543
> Is it possible to use `scrcpy` with a command line to type text?
<details>
<summary>Mistral:</summary>
Yes, **`scrcpy`** allows you to type text from the command line using the `--clipboard` or `--shortcut` options, but the most direct way is to use **`adb shell input text`** in combination with `scrcpy`.
### How to Type Text via Command Line with `scrcpy`:
1. **Enable ADB**:
Ensure your Android device is connected via USB (or Wi-Fi) and `adb` is working:
```bash
adb devices
```
(You should see your device listed.)
2. **Type Text**:
Use `adb shell input text` to send text to your device:
```bash
adb shell input text "Hello, this is typed from the command line!"
```
- This will type the text as if you were using the on-screen keyboard.
- **Note**: This method does not work in all apps (e.g., some secure fields like passwords may block it).
3. **Alternative: `scrcpy` + Clipboard**:
If you want to paste text from your computer's clipboard:
```bash
scrcpy --clipboard
```
- Copy text on your computer, then press **Ctrl+V** in `scrcpy` to paste it.
4. **Shortcut for Special Keys**:
Use `scrcpy --shortcut` to map keyboard shortcuts (e.g., `Ctrl+C` to copy, `Ctrl+V` to paste).
---
### Example Workflow:
1. Open a text field on your Android device (e.g., in a notes app).
2. Run:
```bash
adb shell input text "This is a test."
```
The text will appear in the active field.
---
### Limitations:
- Some apps (e.g., banking apps) may block `adb input` for security.
- Special characters or Unicode may require additional escaping.
</details>
https://chatgpt.com/share/69f94812-7408-83eb-b99f-27771cd9f54cc
<details>
<summary>Error:</summary>
```
Traceback (most recent call last):
File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 1205, in <module>
backupOrRestoreApp(PACKAGE_NAME)
File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 569, in backupOrRestoreApp
exec(getAppScript(PACKAGE_NAME))
File "<string>", line 140, in <module>
File "/home/CENSORED/Desktop/Benjamin/Backup_Android_apps/./main.py", line 361, in writeText
text = unidecode(text)
^^^^^^^^^^^^^^^
File "/home/CENSORED/venv/lib/python3.12/site-packages/unidecode/__init__.py", line 60, in unidecode_expect_ascii
bytestring = string.encode('ASCII')
^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'encode'
```
</details>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
See Benjamin_Loison/Backup_Android_apps/issues/81#issuecomment-10126176.
Would help Benjamin_Loison/Backup_Android_apps/issues/76.
works as wanted.
Genymobile/scrcpy/pull/1426 may help.
https://blog.rom1v.com/2018/03/introducing-scrcpy/#handle-accented-characters
may help.
DuckDuckGo and Google search scrcpy type command.
https://chat.mistral.ai/chat/ec79efb8-30c3-439b-9186-159b76877543
Mistral:
Yes,
scrcpyallows you to type text from the command line using the--clipboardor--shortcutoptions, but the most direct way is to useadb shell input textin combination withscrcpy.How to Type Text via Command Line with
scrcpy:Enable ADB:
Ensure your Android device is connected via USB (or Wi-Fi) and
adbis working:(You should see your device listed.)
Type Text:
Use
adb shell input textto send text to your device:Alternative:
scrcpy+ Clipboard:If you want to paste text from your computer's clipboard:
scrcpyto paste it.Shortcut for Special Keys:
Use
scrcpy --shortcutto map keyboard shortcuts (e.g.,Ctrl+Cto copy,Ctrl+Vto paste).Example Workflow:
Limitations:
adb inputfor security.https://chatgpt.com/share/69f94812-7408-83eb-b99f-27771cd9f54cc
Error: