From 0c212556c9224a7f8d861dcba1b30a794d7462a7 Mon Sep 17 00:00:00 2001 From: whoamikyo Date: Thu, 25 Jun 2020 12:57:06 -0300 Subject: [PATCH] Added admin elevation check again - Some users are reporting a lot of permission issues. --- alas.bat | 16 ++++++++++++++++ dev_tools.bat | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/alas.bat b/alas.bat index a989dbdf6..48b7f15cd 100644 --- a/alas.bat +++ b/alas.bat @@ -1,5 +1,6 @@ @SETLOCAL EnableExtensions EnableDelayedExpansion @echo off +pushd "%~dp0" title ALAS run SET ADB=%~dp0python-3.7.6.amd64\Lib\site-packages\adbutils\binaries\adb.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 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 set SCREENSHOT_FOLDER=%~dp0screenshots diff --git a/dev_tools.bat b/dev_tools.bat index c6ce44d0a..0527de943 100644 --- a/dev_tools.bat +++ b/dev_tools.bat @@ -1,13 +1,29 @@ @echo off setlocal EnableDelayedExpansion title Dev_tools +pushd "%~dp0" :: ----------------------------------------------------------------------------- SET ADB_PATH=%~dp0python-3.7.6.amd64\Lib\site-packages\adbutils\binaries\adb.exe SET ADB=%ADB_PATH% SET PYTHON_PATH=%~dp0python-3.7.6.amd64\python.exe 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 if not exist %SCREENSHOT_FOLDER% ( mkdir %SCREENSHOT_FOLDER% @@ -53,6 +69,7 @@ CALL %ADB% connect %ADB_PORT% echo 7. word_template_extractor echo 8. ADB SCREENSHOT (for ASSETS) echo 9. Uiautomator2 SCREENSHOT (for ASSETS) + echo 10. ADB SCREENSHOT (Continuous Screenshot) echo. echo :: Type a 'number' and press ENTER echo :: Type 'exit' to quit @@ -68,6 +85,7 @@ CALL %ADB% connect %ADB_PORT% if %menu%==7 GOTO word_template_extractor if %menu%==8 GOTO adbss if %menu%==9 GOTO u2ss + if %menu%==10 GOTO adbc if %menu%==exit GOTO EOF else ( @@ -226,13 +244,30 @@ goto adbss call %PYTHON% -m dev_tools.uiautomator2_screenshot echo The file *.png has been copied to ./screenshots/ directory pause > NUL + goto dev_menu ) 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. 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 exit \ No newline at end of file