From a2eba8d4cae61182ed0b60407c2b62bb615d9cc7 Mon Sep 17 00:00:00 2001 From: ncnnnnn <67086033+ncnnnnn@users.noreply.github.com> Date: Thu, 12 Jan 2023 08:55:59 +0800 Subject: [PATCH] add devices msgbox prompt --- app/data/scrcpy-noconsole.vbs | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/app/data/scrcpy-noconsole.vbs b/app/data/scrcpy-noconsole.vbs index d509ad7f..28503186 100644 --- a/app/data/scrcpy-noconsole.vbs +++ b/app/data/scrcpy-noconsole.vbs @@ -1,7 +1,25 @@ strCommand = "cmd /c scrcpy.exe" - -For Each Arg In WScript.Arguments - strCommand = strCommand & " """ & replace(Arg, """", """""""""") & """" -Next - -CreateObject("Wscript.Shell").Run strCommand, 0, false +Dim oShell,exeRs +Set oShell = CreateObject("WSCript.shell") +commandLine = "adb.exe devices" +Set exeRs = oShell.Exec(commandLine) +outs = exeRs.StdOut.ReadAll() +strs= Split(outs,VbCrLf) +Dim dev +for i=1 to ubound(strs) + dev = Replace(strs(i), "device", "") + dev = Replace(dev, " ", "") + dev = Trim(dev) + If (Len(dev)) then + v=MsgBox("scrcpy -s "&dev&"?",1) + If ( v =1 ) then + strCommand = strCommand & " -s " & dev + For Each Arg In WScript.Arguments + strCommand = strCommand & " """ & replace(Arg, """", """""""""") & """" + Next + CreateObject("Wscript.Shell").Run strCommand, 0, false + End If + End If +next +Set oShell = Nothing +Set exeRs = Nothing