mirror of https://github.com/Genymobile/scrcpy
Update scrcpy-noconsole.vbs
Doesnt Open a new Scrcpy window if one is already open. This prevents echoing when playing Audio on pc.pull/4357/head
parent
1ee46970e3
commit
6841da0824
@ -1,7 +1,32 @@
|
|||||||
strCommand = "cmd /c scrcpy.exe"
|
strProcessName = "scrcpy.exe"
|
||||||
|
bFound = False
|
||||||
|
|
||||||
For Each Arg In WScript.Arguments
|
' Check if scrcpy.exe is already running
|
||||||
strCommand = strCommand & " """ & replace(Arg, """", """""""""") & """"
|
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
|
||||||
|
Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process")
|
||||||
|
|
||||||
|
For Each objProcess in colProcesses
|
||||||
|
If InStr(1, objProcess.Name, strProcessName, vbTextCompare) > 0 Then
|
||||||
|
' scrcpy.exe is already running
|
||||||
|
bFound = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
CreateObject("Wscript.Shell").Run strCommand, 0, false
|
If bFound Then
|
||||||
|
' Bring scrcpy window to the foreground, unless its minimized
|
||||||
|
Set objShell = CreateObject("WScript.Shell")
|
||||||
|
|
||||||
|
' Activate the window by title
|
||||||
|
objShell.AppActivate("2201116PG")
|
||||||
|
|
||||||
|
Else
|
||||||
|
' scrcpy.exe is not running, so start it
|
||||||
|
strCommand = "cmd /c scrcpy.exe"
|
||||||
|
|
||||||
|
For Each Arg In WScript.Arguments
|
||||||
|
strCommand = strCommand & " """ & Replace(Arg, """", """""") & """"
|
||||||
|
Next
|
||||||
|
|
||||||
|
CreateObject("WScript.Shell").Run strCommand, 0, False
|
||||||
|
End If
|
||||||
|
Loading…
Reference in New Issue