-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd9041e
commit 483befb
Showing
10 changed files
with
284 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ test.html | |
*.dll | ||
*.conf | ||
*.properties | ||
*.bat | ||
NOTICE.txt | ||
browser_usage.txt | ||
status.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Option Explicit | ||
Dim fso, shell, outputFile, devicesExec, devicesOutput, deviceLines, lastLine, i | ||
|
||
Set shell = CreateObject("WScript.Shell") | ||
Set fso = CreateObject("Scripting.FileSystemObject") | ||
|
||
shell.CurrentDirectory = "./scripts/shizuku" | ||
|
||
Set outputFile = fso.CreateTextFile("../scriptStatus.txt", True) | ||
outputFile.WriteLine("Searching for Device...") | ||
outputFile.WriteLine("0") | ||
outputFile.Close | ||
|
||
shell.Exec("cmd /c adb tcpip 5555") | ||
WScript.Sleep 5000 | ||
|
||
Set outputFile = fso.CreateTextFile("../scriptStatus.txt", True) | ||
outputFile.WriteLine("Keep Waiting...") | ||
outputFile.WriteLine("0") | ||
outputFile.Close | ||
|
||
WScript.Sleep 5000 | ||
|
||
' Run the adb devices command and capture the output | ||
Set devicesExec = shell.Exec("cmd /c adb devices") | ||
Do While devicesExec.Status = 0 | ||
WScript.Sleep 100 | ||
Loop | ||
devicesOutput = devicesExec.StdOut.ReadAll() | ||
|
||
deviceLines = Split(devicesOutput, vbCrLf) | ||
|
||
' Get the last non-empty line of the output | ||
lastLine = "" | ||
For i = UBound(deviceLines) To 0 Step -1 | ||
If Trim(deviceLines(i)) <> "" Then | ||
lastLine = deviceLines(i) | ||
Exit For | ||
End If | ||
Next | ||
|
||
Set outputFile = fso.CreateTextFile("../scriptStatus.txt", True) | ||
|
||
If LCase(Left(lastLine, 3)) = "adb" And _ | ||
LCase(Right(lastLine, 6)) = "device" Then | ||
outputFile.WriteLine("Connected successfully") | ||
outputFile.WriteLine("1") | ||
shell.Run "scrcpy-noconsole.vbs" | ||
Else | ||
outputFile.WriteLine("Please Pair Device") | ||
outputFile.WriteLine("1") | ||
End If | ||
|
||
outputFile.Close | ||
|
||
WScript.Sleep 500 | ||
fso.DeleteFile "../scriptStatus.txt", True | ||
|
||
Set fso = Nothing | ||
Set shell = Nothing | ||
Set outputFile = Nothing | ||
Set devicesExec = Nothing |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Option Explicit | ||
Dim fso, shell, outputFile, devicesExec, devicesOutput, deviceLines, lastLine, i | ||
|
||
Set shell = CreateObject("WScript.Shell") | ||
Set fso = CreateObject("Scripting.FileSystemObject") | ||
|
||
shell.CurrentDirectory = "./scripts/shizuku" | ||
|
||
Set outputFile = fso.CreateTextFile("../scriptStatus.txt", True) | ||
outputFile.WriteLine("Searching for Device...") | ||
outputFile.WriteLine("0") | ||
outputFile.Close | ||
|
||
' Run the adb devices command and capture the output | ||
Set devicesExec = shell.Exec("cmd /c adb devices") | ||
Do While devicesExec.Status = 0 | ||
WScript.Sleep 100 | ||
Loop | ||
devicesOutput = devicesExec.StdOut.ReadAll() | ||
|
||
deviceLines = Split(devicesOutput, vbCrLf) | ||
|
||
' Get the last non-empty line of the output | ||
lastLine = "" | ||
For i = UBound(deviceLines) To 0 Step -1 | ||
If Trim(deviceLines(i)) <> "" Then | ||
lastLine = deviceLines(i) | ||
Exit For | ||
End If | ||
Next | ||
|
||
Set outputFile = fso.CreateTextFile("../scriptStatus.txt", True) | ||
|
||
If LCase(Left(lastLine, 3)) = "adb" And _ | ||
LCase(Right(lastLine, 6)) = "device" Then | ||
outputFile.WriteLine("Paired successfully") | ||
outputFile.WriteLine("1") | ||
Else | ||
outputFile.WriteLine("Device Not Found") | ||
outputFile.WriteLine("1") | ||
End If | ||
|
||
outputFile.Close | ||
|
||
shell.Exec("cmd /c adb tcpip 5555") | ||
|
||
WScript.Sleep 500 | ||
fso.DeleteFile "../scriptStatus.txt", True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
strCommand = "cmd /c scrcpy.exe" | ||
|
||
For Each Arg In WScript.Arguments | ||
strCommand = strCommand & " """ & replace(Arg, """", """""""""") & """" | ||
Next | ||
|
||
CreateObject("Wscript.Shell").Run strCommand, 0, false |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.