mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
docs: engines module
This commit is contained in:
parent
19dac12614
commit
37dc1966dc
@ -84,6 +84,11 @@
|
||||
"type": "markdown",
|
||||
"path":"documentation"
|
||||
},
|
||||
{
|
||||
"title": "脚本引擎",
|
||||
"type": "markdown",
|
||||
"path":"documentation"
|
||||
},
|
||||
{
|
||||
"title": "模块与第三方jar",
|
||||
"type": "markdown",
|
||||
|
||||
54
app/src/main/assets/help/documentation/脚本引擎.md
Normal file
54
app/src/main/assets/help/documentation/脚本引擎.md
Normal file
@ -0,0 +1,54 @@
|
||||
# engines
|
||||
|
||||
engines模块包含了一些与脚本引擎有关的函数,包括运行其他脚本,关闭脚本等。
|
||||
|
||||
### engines.execScript(name, script\[, config\])
|
||||
* name \<String\> 要运行的脚本名称。这个名称和文件名称无关,只是在任务管理中显示的名称。
|
||||
* script \<String\> 要运行的脚本内容。
|
||||
* config \<Object\> 运行配置项
|
||||
* delay \<Number\> 延迟执行的毫秒数,默认为0
|
||||
* loopTimes \<Number\> 循环运行次数,默认为1
|
||||
* interval \<Number\> 循环运行时两次运行之间的时间间隔,默认为0
|
||||
* path \<Array\> | \<String\> 指定脚本运行的目录。这个路径会用于require时寻找模块文件。
|
||||
|
||||
在新线程中运行脚本script。返回一个\[ScriptExecution\](#ScriptExecution)对象。
|
||||
|
||||
### engines.execScriptFile(path, \[config\])
|
||||
* path \<String\> 要运行的脚本路径。
|
||||
* config \<Object\> 运行配置项
|
||||
* delay \<Number\> 延迟执行的毫秒数,默认为0
|
||||
* loopTimes \<Number\> 循环运行次数,默认为1
|
||||
* interval \<Number\> 循环运行时两次运行之间的时间间隔,默认为0
|
||||
* path \<Array\> | \<String\> 指定脚本运行的目录。这个路径会用于require时寻找模块文件。
|
||||
|
||||
在新线程中运行脚本文件path。返回一个\[ScriptExecution\](#ScriptExecution)对象。
|
||||
|
||||
### engines.execAutoFile(path, \[config\])
|
||||
* path \<String\> 要运行的录制文件路径。
|
||||
* config \<Object\> 运行配置项
|
||||
* delay \<Number\> 延迟执行的毫秒数,默认为0
|
||||
* loopTimes \<Number\> 循环运行次数,默认为1
|
||||
* interval \<Number\> 循环运行时两次运行之间的时间间隔,默认为0
|
||||
* path \<Array\> | \<String\> 指定脚本运行的目录。这个路径会用于require时寻找模块文件。
|
||||
|
||||
在新线程中运行录制文件path。返回一个\[ScriptExecution\](#ScriptExecution)对象。
|
||||
|
||||
### engines.stopAll()
|
||||
|
||||
停止所有正在运行的脚本。包括当前脚本自身。
|
||||
|
||||
### engines.stopAllAndToast()
|
||||
|
||||
停止所有正在运行的脚本并显示停止的脚本数量。包括当前脚本自身。
|
||||
|
||||
# ScriptExecution
|
||||
|
||||
执行脚本时返回的对象,可以通过他获取执行的引擎、
|
||||
|
||||
### ScriptExecution.getEngine()
|
||||
|
||||
### ScriptExecution.getConfig()
|
||||
|
||||
### ScriptExecution.getSource()
|
||||
|
||||
先写到这儿吧:-)
|
||||
@ -1,6 +1,6 @@
|
||||
var script = "toast('Hello, Auto.js');" +
|
||||
"sleep(3000);" +
|
||||
"toast('略略略');";
|
||||
var execution = engines.execScript(script);
|
||||
var execution = engines.execScript("Hello", script);
|
||||
sleep(1000);
|
||||
execution.getEngine().forceStop();
|
||||
Loading…
Reference in New Issue
Block a user