@echo off
setlocal enabledelayedexpansion
REM 设置循环次数
set loop_count=2147483647
REM 执行循环
for /l %%i in (1, 1, %loop_count%) do (
echo Loop: %%i
REM 启动应用
adb -s 183.60.151.152:22780 shell am start -n com.miHoYo.hkrpg/com.mihoyo.combosdk.ComboSDKActivity
adb -s 183.60.151.152:22779 shell am start -n com.miHoYo.hkrpg/com.mihoyo.combosdk.ComboSDKActivity
timeout /t 20
REM 获取进程数量
for /f %%j in ('adb -s 183.60.151.152:22780 shell "ps -T -p $(pidof com.miHoYo.hkrpg) | grep UnityMain | wc -l"') do set return_code_1=%%j
for /f %%j in ('adb -s 183.60.151.152:22779 shell "ps -T -p $(pidof com.miHoYo.hkrpg) | grep UnityMain | wc -l"') do set return_code_2=%%j
REM 检测返回值是否小于等于 1
set /a decimal_value_1 = !return_code_1!
set /a decimal_value_2 = !return_code_2!
echo !decimal_value_1!
echo !decimal_value_2!
if !decimal_value_1! leq 1 (
echo Test Finish!
goto :EndLoop
)
if !decimal_value_2! leq 1 (
echo Test Finish!
goto :EndLoop
)
REM 模拟滑动操作
start /b adb -s 183.60.151.152:22780 shell input swipe 800 540 800 540 100
adb -s 183.60.151.152:22779 shell input swipe 800 540 800 540 100
timeout /t 10
for /l %%k in (1, 1, 3) do (
start /b adb -s 183.60.151.152:22780 shell input swipe 1500 540 10 540 1000
adb -s 183.60.151.152:22779 shell input swipe 1500 540 10 540 1000
)
REM 关闭应用
adb -s 183.60.151.152:22780 shell am force-stop com.miHoYo.hkrpg
adb -s 183.60.151.152:22779 shell am force-stop com.miHoYo.hkrpg
)
:EndLoop
endlocal