Comments (5)
bat和sh都不好用,还是用python吧。
import adbutils
from adbutils import adb
import re,os,glob
# https://github.com/openatx/adbutils
# https://blog.csdn.net/xiaoerbuyu1233/article/details/122124201
adb = adbutils.AdbClient(host="127.0.0.1", port=5037)
for info in adb.list():
print(info.serial, info.state)
# <serial> <device|offline>
for d in adb.device_list():
print(d.serial) # print device serial
# 点亮屏幕
d.shell("input keyevent KEYCODE_POWER")
# 解锁
d.shell("input keyevent 82")
# 关屏时间
d.shell("settings put system screen_off_timeout 10000000")
# 屏幕常亮?? https://www.jianshu.com/p/bae933aac556 在我的手机上,不管用。。。妈的
d.shell("svc power stayon usb")
for f in glob.glob(r'E:\code\open\kuaishou\**\*.js',recursive=True):
localPath=f
phonePath=f.replace("E:\code\open\kuaishou","/storage/emulated/0/脚本/kuaishou").replace("\\","/")
print(localPath)
print(phonePath)
d.sync.push(localPath,phonePath)
``
from auto.js-vscode-extension.
附上其他解决方式。vscode插件,Batch Runner,加上一个bat脚本,在linux环境,用sh脚本即可。
下面是一个基本的ADB脚本,可以将电脑上的文件夹同步到安卓手机上。请注意,你需要在Windows操作系统上运行该脚本,并确保已经安装了ADB工具。
bat复制代码
@echo off
setlocal enabledelayedexpansion
rem 设置ADB工具的路径
set ADB_PATH=C:\adb\platform-tools
rem 设置电脑上要同步的文件夹路径
set PC_FOLDER_PATH=C:\Path\to\Your\Folder
rem 设置手机上要同步的目标路径
set PHONE_FOLDER_PATH=/sdcard/Path/to/Your/Folder
rem 连接到手机
%ADB_PATH%\adb devices
rem 确认是否正确连接到设备
:devicecheck
%ADB_PATH%\adb get-state | find "device"
if %errorlevel% neq 0 (
echo 无法找到连接的设备,请检查设备是否正确连接。
pause
exit
)
rem 创建手机上的目标文件夹
%ADB_PATH%\adb shell mkdir -p "%PHONE_FOLDER_PATH%"
rem 同步文件夹到手机
%ADB_PATH%\adb push "%PC_FOLDER_PATH%" "%PHONE_FOLDER_PATH%"
rem 断开与手机的连接
%ADB_PATH%\adb disconnect
endlocal
在使用这个脚本之前,请确保以下事项:
将C:\adb\platform-tools替换为你的ADB工具的实际路径。
将C:\Path\to\Your\Folder替换为你要同步到手机的文件夹的路径。
将/sdcard/Path/to/Your/Folder替换为手机上要存储同步文件夹的目标路径。
保存脚本为.bat文件,双击运行即可开始同步。
from auto.js-vscode-extension.
不再使用插件提供的保存项目功能。改用文件同步+脚本引擎启动脚本。
使用,脚本同步文件夹之后。存在的问题,就是多项目调试。的时候,需要不停的手动切换,app上面的路径。以适配不同的文件夹。
现在,采用一个,在app,设置的目录的根目录,加上,projectXXX.js ,通过脚本引擎的方式,追加,path,参数。来执行项目。
解决,多个项目,调试起来,难受的问题。
// projectXXX.js
log("开始执行脚本");
engines.execScriptFile("/storage/emulated/0/脚本/projectXXX/main.js", {
path: "/storage/emulated/0/脚本/projectXXX/",
});
// projectYYY.js
log("开始执行脚本");
engines.execScriptFile("/storage/emulated/0/脚本/projectYYY/main.js", {
path: "/storage/emulated/0/脚本/projectYYY/",
});
from auto.js-vscode-extension.
你说的这种要进行编译运行,有一个专门的工程
from auto.js-vscode-extension.
用这个吧,官网推荐的,编译后会把多个js文件编译到一起,还能混淆。https://github.com/kkevsekk1/webpack-autojs/tree/master
from auto.js-vscode-extension.
Related Issues (16)
- 能用ip地址连接,但是qr code不会显示 HOT 3
- 发现Auto.js-Autox.js-VSCodeExt v1.109.0版本插件一个bug HOT 1
- 无法执行代码 HOT 2
- 保存项目到设备没反应 HOT 2
- 补全代码的提示出现错误 HOT 1
- 9317端口被 HOT 2
- 保存到所有设备(save)-保存图片
- 希望能够添加自定义服务器端口的功能 HOT 1
- app示例代码点击编辑按钮,页面空白
- 可否新增类似 git 的 .gitignore 文件? HOT 1
- 关于Auto.js-Autox.js-VSCodeExt v1.109.0不显示二维码的临时解决办法 HOT 7
- 这插件要配合 webpack-autojs 这个工程使用是最佳实践,否则用最原始版本无任何差异。 HOT 1
- Connect Error: Error: socket hang up 手机连接电脑报错:连接超时 HOT 4
- 请求增加快照捕获服务
- 平板无法自我通过127.0.01握手
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from auto.js-vscode-extension.