1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-29 13:57:13 +08:00

Added admin elevation check again

- Some users are reporting a lot of permission issues.
This commit is contained in:
whoamikyo
2020-06-25 12:57:06 -03:00
parent 75fd7aee0d
commit 0c212556c9
2 changed files with 53 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
@SETLOCAL EnableExtensions EnableDelayedExpansion @SETLOCAL EnableExtensions EnableDelayedExpansion
@echo off @echo off
pushd "%~dp0"
title ALAS run title ALAS run
SET ADB=%~dp0python-3.7.6.amd64\Lib\site-packages\adbutils\binaries\adb.exe SET ADB=%~dp0python-3.7.6.amd64\Lib\site-packages\adbutils\binaries\adb.exe
SET PYTHON=%~dp0python-3.7.6.amd64\python.exe SET PYTHON=%~dp0python-3.7.6.amd64\python.exe
@@ -7,6 +8,21 @@ SET CMD=%SystemRoot%\system32\cmd.exe
SET LMESZINC=https://github.com/LmeSzinc/AzurLaneAutoScript.git SET LMESZINC=https://github.com/LmeSzinc/AzurLaneAutoScript.git
SET WHOAMIKYO=https://github.com/whoamikyo/AzurLaneAutoScript.git SET WHOAMIKYO=https://github.com/whoamikyo/AzurLaneAutoScript.git
:: ----------------------------------------------------------------------------- :: -----------------------------------------------------------------------------
goto check_Permissions
:check_Permissions
echo Administrative permissions required. Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
pause >nul
goto continue
) else (
echo Failure: Current permissions inadequate.
)
pause >nul
:: -----------------------------------------------------------------------------
:continue
call %ADB% kill-server > nul 2>&1 call %ADB% kill-server > nul 2>&1
set SCREENSHOT_FOLDER=%~dp0screenshots set SCREENSHOT_FOLDER=%~dp0screenshots

View File

@@ -1,13 +1,29 @@
@echo off @echo off
setlocal EnableDelayedExpansion setlocal EnableDelayedExpansion
title Dev_tools title Dev_tools
pushd "%~dp0"
:: ----------------------------------------------------------------------------- :: -----------------------------------------------------------------------------
SET ADB_PATH=%~dp0python-3.7.6.amd64\Lib\site-packages\adbutils\binaries\adb.exe SET ADB_PATH=%~dp0python-3.7.6.amd64\Lib\site-packages\adbutils\binaries\adb.exe
SET ADB=%ADB_PATH% SET ADB=%ADB_PATH%
SET PYTHON_PATH=%~dp0python-3.7.6.amd64\python.exe SET PYTHON_PATH=%~dp0python-3.7.6.amd64\python.exe
SET PYTHON=%PYTHON_PATH% SET PYTHON=%PYTHON_PATH%
:: ----------------------------------------------------------------------------- :: -----------------------------------------------------------------------------
goto check_Permissions
:check_Permissions
echo Administrative permissions required. Detecting permissions...
net session >nul 2>&1
if %errorLevel% == 0 (
echo Success: Administrative permissions confirmed.
pause >nul
goto continue
) else (
echo Failure: Current permissions inadequate.
)
pause >nul
:: -----------------------------------------------------------------------------
:continue
set FILE_PREFIX=screenshot
set SCREENSHOT_FOLDER=%~dp0screenshots set SCREENSHOT_FOLDER=%~dp0screenshots
if not exist %SCREENSHOT_FOLDER% ( if not exist %SCREENSHOT_FOLDER% (
mkdir %SCREENSHOT_FOLDER% mkdir %SCREENSHOT_FOLDER%
@@ -53,6 +69,7 @@ CALL %ADB% connect %ADB_PORT%
echo 7. word_template_extractor echo 7. word_template_extractor
echo 8. ADB SCREENSHOT (for ASSETS) echo 8. ADB SCREENSHOT (for ASSETS)
echo 9. Uiautomator2 SCREENSHOT (for ASSETS) echo 9. Uiautomator2 SCREENSHOT (for ASSETS)
echo 10. ADB SCREENSHOT (Continuous Screenshot)
echo. echo.
echo :: Type a 'number' and press ENTER echo :: Type a 'number' and press ENTER
echo :: Type 'exit' to quit echo :: Type 'exit' to quit
@@ -68,6 +85,7 @@ CALL %ADB% connect %ADB_PORT%
if %menu%==7 GOTO word_template_extractor if %menu%==7 GOTO word_template_extractor
if %menu%==8 GOTO adbss if %menu%==8 GOTO adbss
if %menu%==9 GOTO u2ss if %menu%==9 GOTO u2ss
if %menu%==10 GOTO adbc
if %menu%==exit GOTO EOF if %menu%==exit GOTO EOF
else ( else (
@@ -226,13 +244,30 @@ goto adbss
call %PYTHON% -m dev_tools.uiautomator2_screenshot call %PYTHON% -m dev_tools.uiautomator2_screenshot
echo The file *.png has been copied to ./screenshots/ directory echo The file *.png has been copied to ./screenshots/ directory
pause > NUL pause > NUL
goto dev_menu
) else ( ) else (
echo :: it was not possible to open ddev_tools.uiautomator2_screenshot, make sure you have a folder python-3.7.6.amd64 echo :: it was not possible to open dev_tools.uiautomator2_screenshot, make sure you have a folder python-3.7.6.amd64
echo :: inside AzurLaneAutoScript folder. echo :: inside AzurLaneAutoScript folder.
echo. echo.
pause > NUL pause > NUL
goto dev_menu
) )
goto dev_menu
:: ----------------------------------------------------------------------------- :: -----------------------------------------------------------------------------
:adbc
rem create output file name and path from parameters and date and time
rem loop
:CLOCK
rem FOR /L %%A IN (1,1,1) DO (
rem removing the upper for loop
set Timestamp=%date:~0,2%-%date:~3,2%-%date:~6,4%-%time:~0,2%-%time:~3,2%-%time:~6,2%-%time:~9,2%
set SCREENCAP_FILE_NAME=%FILE_PREFIX%-%Timestamp%.png
set SCREENCAP_FILE_PATH=%SCREENSHOT_FOLDER%%SCREENCAP_FILE_NAME%
rem calling adb shell screencap, pull and remove the previos file
call %ADB% shell screencap -p %SCREENCAP_FILE_PATH%
call %ADB% pull %SCREENCAP_FILE_PATH%
call %ADB% shell rm %SCREENCAP_FILE_PATH%
goto:CLOCK
:EOF :EOF
exit exit