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

Run scrcpy-noconsole and, if an error occurs, inform the user. #4136

Open
1 task done
XayUp opened this issue Jul 3, 2023 · 3 comments
Open
1 task done

Run scrcpy-noconsole and, if an error occurs, inform the user. #4136

XayUp opened this issue Jul 3, 2023 · 3 comments

Comments

@XayUp
Copy link

XayUp commented Jul 3, 2023

Is your feature request related to a problem? Please describe.
I have to wait a while to find out if the device will actually be mirrored when I run "scrcpy-noconsole.vbs" since it doesn't tell me if it gives an error or if it really will mirror.

Describe the solution you'd like
Run scrcpy initially with the console and disappear as soon as the pecking window opens, with some command line that allows the user to choose if, when an error occurs, the console closes or remains open.

Describe alternatives you've considered
Wait some time after trying to run scrcpy without console and if the mirror does not open, I thought that possibly there was an error or open normally with the console, because I hope to know if there was an error or not, but the console will be there.

Additional context
When creating a launch script with those already defined in a ".cmd" or ".bat" file (on windows) but expect only a mirroring window, without the console open/minimized while mirroring.

@rom1v
Copy link
Collaborator

rom1v commented Jul 3, 2023

Run scrcpy initially with the console and disappear as soon as the pecking window opens

I don't know how to do that for Windows.

On Linux, you can just launch scrcpy & then close the console (with Ctrl+d) when you want (or similarly run scrcpy and press Ctrl+z at any time to make the process background, then close the console).

Refs #1988 (comment)

@XayUp
Copy link
Author

XayUp commented Jul 3, 2023

I don't know how to do that for Windows.

It doesn't necessarily have to be the console, but anything that lets you know that Scrcpy has spoken if an error occurs. I think the type of ".vb" file provides something that returns some kind of "errorlevel", just like batch, in case that application fails, so you say what to do if an error occurs, how to create a floating box (already I saw that the scripts in "vb" have this possibility). Changes will probably only be made to the ".vb" file. Unfortunately I am not familiar with this language.

Tomorrow I will study this language (I hope I'm not too lazy :D)

@XayUp
Copy link
Author

XayUp commented Jul 4, 2023

@rom1v I found what I wanted. I think it's cool that you can make it default in Scrcpy downloads <3:

strCommand = "cmd /c scrcpy.exe"

For Each Arg In WScript.Arguments
    strCommand = strCommand & " """ & replace(Arg, """", """""""""") & """"
Next

errorlevel = CreateObject("Wscript.Shell").Run(strCommand, 0, True)

If errorlevel = 1 Then MsgBox "No devices found. Please connect your device." End If
If errorlevel = 2 Then MsgBox "The device unexpectedly disconnected." End If

Use this in the ".vbs" script file

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