5
5
:: Last updated: 2020-08-23
6
6
:: >>> Get updated from: https://github.com/LmeSzinc/AzurLaneAutoScript <<<
7
7
@ echo off
8
+ chcp | find " 932" > NUL && set " IME = true" || set " IME = false"
9
+ if " %IME% " == " true" (
10
+ echo ====================================================================================================
11
+ echo Incorrect encoding, visit this link to correct: https://bit.ly/34t8ubY
12
+ echo To copy, select the link and CTRL+SHFT+C
13
+ echo ====================================================================================================
14
+ pause
15
+ goto :eof
16
+ )
8
17
pushd " %~dp0 "
9
18
setlocal EnableDelayedExpansion
10
19
set " Version = 3.0"
@@ -19,6 +28,17 @@ set "root=%~dp0"
19
28
set " root = %root:~0 ,-1 % "
20
29
cd " %root% "
21
30
31
+ rem ================= Variables =================
32
+
33
+ set " pyBin = %root% \toolkit\python.exe"
34
+ set " adbBin = %root% \toolkit\Lib\site-packages\adbutils\binaries\adb.exe"
35
+ set " gitBin = %root% \toolkit\Git\mingw64\bin\git.exe"
36
+ set " curlBin = %root% \toolkit\Git\mingw64\bin\curl.exe"
37
+ set " api_json = %root% \config\api_git.json"
38
+ set " AlasConfig = %root% \config\alas.ini"
39
+ set " template = %root% \config\template.ini"
40
+ set " gitFolder = %root% \.git"
41
+
22
42
:: Import main settings (%Language%, %Region%, %SystemType%) and translation text.
23
43
call command\Get.bat Main
24
44
:: Import the Proxy setting and apply. Then show more info in Option6.
@@ -32,14 +52,6 @@ call command\Get.bat DeployMode
32
52
33
53
:: Start of Deployment
34
54
title Alas Run Tool V3
35
- set " pyBin = %root% \toolkit\python.exe"
36
- set " adbBin = %root% \toolkit\Lib\site-packages\adbutils\binaries\adb.exe"
37
- set " gitBin = %root% \toolkit\Git\mingw64\bin\git.exe"
38
- set " curlBin = %root% \toolkit\Git\mingw64\bin\curl.exe"
39
- set " api_json = %root% \config\api_git.json"
40
- set " AlasConfig = %root% \config\alas.ini"
41
- set " template = %root% \config\template.ini"
42
- set " gitFolder = %root% \.git"
43
55
if " %IsUsingGit% " == " yes" if " %DeployMode% " == " unknown" ( xcopy /Y toolkit\config .git\ > NUL )
44
56
call :UpdateChecker_Alas
45
57
@@ -104,7 +116,6 @@ rem ================= OPTION 1 =================
104
116
:en
105
117
call :CheckBsBeta
106
118
call :AdbConnect
107
- rem call :uiautomator2init
108
119
echo ====================================================================================================
109
120
echo Python Found in %pyBin% Proceeding..
110
121
echo Opening alas_en.pyw in %root%
@@ -118,7 +129,6 @@ rem ================= OPTION 2 =================
118
129
:cn
119
130
call :CheckBsBeta
120
131
call :AdbConnect
121
- rem call :uiautomator2init
122
132
echo ====================================================================================================
123
133
echo Python Found in %pyBin% Proceeding..
124
134
echo Opening alas_en.pyw in %root%
@@ -131,7 +141,6 @@ rem ================= OPTION 3 =================
131
141
:jp
132
142
call :CheckBsBeta
133
143
call :AdbConnect
134
- rem call :uiautomator2init
135
144
echo ====================================================================================================
136
145
echo Python Found in %pyBin% Proceeding..
137
146
echo Opening alas_en.pyw in %root%
@@ -413,6 +422,11 @@ goto ReturnToSetting
413
422
414
423
rem ================= FUNCTIONS =================
415
424
425
+ :CheckAdbConnect
426
+ for /f " tokens=1*" %%g IN ('%adbBin% connect 127.0.0.1:5555') do set adbCheck = %%g
427
+ if " %adbCheck% " == " cannot"
428
+ echo %adbCheck%
429
+
416
430
:ReturnToSetting
417
431
echo . & echo Press any key to continue...
418
432
pause > NUL
@@ -444,6 +458,7 @@ for /f "tokens=3" %%a in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\BlueStacks_bgp6
444
458
set SerialRealtime = 127.0.0.1:%port%
445
459
echo ====================================================================================================
446
460
echo connecting at %SerialRealtime%
461
+ %adbBin% kill-server > nul 2 >& 1
447
462
%adbBin% connect %SerialRealtime%
448
463
echo ====================================================================================================
449
464
if " %FirstRun% " == " yes" (
@@ -456,14 +471,23 @@ echo Old Serial: %SerialAlas%
456
471
echo New Serial: %SerialRealtime%
457
472
echo ====================================================================================================
458
473
echo Press any to continue...
474
+ %pyBin% -m uiautomator2 init
459
475
pause > NUL
460
476
:: -----------------------------------------------------------------------------
461
477
goto :eof
462
478
463
479
:AdbConnect
464
480
if " %RealtimeMode% " == " enable" goto :eof
465
- if " %FirstRun% " == " yes" ( %adbBin% connect %serial_input% && goto :eof )
466
- %adbBin% connect %Serial%
481
+ if " %FirstRun% " == " yes" ( goto :eof )
482
+ %adbBin% kill-server > nul 2 >& 1
483
+ %adbBin% connect %Serial% | find /i " connected to" > nul
484
+ if errorlevel 1 (
485
+ echo The connection was not successful
486
+ goto Serial_setting
487
+ ) else (
488
+ %pyBin% -m uiautomator2 init
489
+ echo The connection was Successful
490
+ )
467
491
goto :eof
468
492
469
493
:KillAdb
0 commit comments