New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何调用 vscode 中的动作? #6
Comments
可以提供更详细的接口参数吗, 比如 cmd 需要那些参数, 分别做什么用, path 又有什么作用, 格式是什么. 例如我猜想到的 cmd 可能是 "run", 发送到 VSCode 后会运行脚本; 也可能是 "stop", 发送后 VSCode 将停止运行当前脚本; 等等. 我需要知道接口参数的功能及说明, 才能让 VSCode 插件对接收到的指令做出预期响应. |
谢谢作者大大的支持。 能否提供 http 接口支持,如 save 的时候,把指定文件或文件内容,类似 vs code 中调用 id, name, script 等(可以保存到指定目录上等)。 saveTo(devices: Devices) {
let editor = vscode.window.activeTextEditor;
devices.sendCommand('save', {
id: editor.document.fileName,
name: editor.document.fileName,
script: editor.document.getText(),
});
} 这个是调用 autoxjs 中的例子 // cmd 是 run 或 save
// path 是本地需要保存或运行的目录值(类似在 vscode 中保存项目)
// 发送部署命令
private sendDeployCmd(execCmd: string, sendPath: string, deployName: string): void {
const req = nodeHttp.get(`http://127.0.0.1:9317/exec?cmd=${execCmd}&path=${encodeURI(sendPath)}`, (res) => {
res.setEncoding('utf8');
res.addListener('data', (data) => {
console.debug('部署执行器: %s -> 执行命令成功!- data: %s', deployName, data);
}).addListener('error', (error) => {
console.error('部署执行器: %s -> 执行命令失败!- error: %s', deployName, error);
});
});
req.addListener('finish', () => {
console.debug('部署执行器: %s -> 发送命令成功! - cmd: %s ; path: %s', deployName, execCmd, sendPath);
});
req.addListener('error', (error) => {
console.error('部署执行器: %s -> 发送命令失败!- error: %s', deployName, error);
});
} |
我看到项目中的 "使用步骤" 如下:
但我还是没能理解具体要怎样操作或测试. 我根据你提供的 "发送部署命令" 方法
我看到你的项目使用的两个命令 'rerun' 和 'save' 都是项目级别的, 因此对应 AutoJs6 VSCode 插件应分别为 'rerunProject' 和 'saveProject'. PS: VSCode 插件 1.0.5 版本暂时还没有发布到 VSCode 插件市场, 计划于本周内发布. |
@SuperMonster003 很棒哟 ~ 我这边这几天更新一下这个模板工程。 |
项目模板已更新,地址:https://github.com/lanaqi-opensource/autojs6-typescript-template |
比如调用保存、重新运行。
autox 中提供 http 接口,127.0.0.1:9317/cmd=x&path=x 这样
原在 autox 中弄了一个基于 TS 的模板:https://github.com/lanaqi-opensource/autox-typescript-template ,现在想用 AutoJs6 却没能对这个项目支持。
PS:想用 AutoJs6 ,感觉 AutoJs6 文档健全点,也没有这么多碎片化。
The text was updated successfully, but these errors were encountered: