Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not use the copy and paste function to solve text input problems in windows? #3970

Closed
1 task done
809825706 opened this issue May 4, 2023 · 2 comments
Closed
1 task done

Comments

@809825706
Copy link

Is your feature request related to a problem? Please describe.

It seems that physical keyboard simulation does not work in windows with mirroring. Therefore, it is a disaster when entering large amounts of text. We can only type non-English words by plainly switching between mouse with keyboard. Why not use existing methods to solve non-English text input problems?

Describe the solution you'd like

As the documentation says, adb only supports the English alphabet, but the clipboard is unaffected. I have tested it this many times, which can type large sections of non-English text by copying and pasting. I input the text in Notepad first and then copy and paste it into SCRCPY when I'm done typing. I think this way is ok with any text editing software. The only problem is to switching between Notepad and SCRCPY. However, this is still a relatively efficient method of text input.

so, why not add a input box and a "send" button at the edge of the SCRCPY window. we can type text in the box and click the button (or shortcut keys) to cut the text in box then paste it to SCRCPY.

@rom1v
Copy link
Collaborator

rom1v commented May 4, 2023

The framework scrcpy uses (SDL) is lightweight, it does not provide widgets, so there is no input text or buttons or other components.

Adding such widgets would require to switch to another one, typically Qt (in C++) for multiplatform, which is not lightweight at all. Ideally, I would extract some parts of scrcpy in a lib, and implement several UI, one SDL and one in Qt, but that would be a lot of work to implement and maintain and keep in sync…

Also see #1426.

@809825706
Copy link
Author

A method to send text to Scrcpy by AutoHotkey on windows system

Introducing a method of using AutoHotkey to send text to Scrcpy in Windows systems, which is alternative way to resolve the problem of special-characters-do-not-work. (only test chinese input, but theoretically universal for all languages.
)

Principle: Use the AutoHotkey to call out the input box, and then paste the text in the input window into the Scrcpy window. As long as the input box of the device in scrcpy is focused, the text will be automatically pasted into it. It uses the clipboard and does not rely on the input method app on Android.

Instructions

  1. Download and install AutoHotkey
  2. Create the ahk script and double-click to run it.
  3. Open the scrcpy window, click on the input text box, press the F1 key, an input window will pop up, enter the text you need to enter, press Enter or click OK.

script

#HotIf WinActive("GM1911") ; limited to GM1911 windows
F1:: ; respond to F1 key
{
    OutputVar := InputBox("input what you want to send to scrcpy", "SCRCPY INPUTBOX").Value
    A_Clipboard := OutputVar  ; Start off empty to allow ClipWait to detect when the text has arrived.
    ClipWait  ; Wait for the clipboard to contain text.
    Send "^v"
    Sleep 500  ; Wait a bit for Ctrl+V to be processed
}

Script interpretation and application

  1. Create a text file at will, paste the above content into it, change the suffix name to "ahk", and double-click to run it.
  2. GM1911 is the name displayed in the title bar of the window when my device is connected to scrcpy. You need to make substitutions based on your own names. This command let AutoHotkey respond to commands only in the GM1911 window.
  3. F1 is my customized hotkey. You can also change it to other ones. Please check the official tutorial for specific settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants