Dying again
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
"path":"documentation"
|
||||
},
|
||||
{
|
||||
"title": "驻留模式与无障碍服务委托",
|
||||
"title": "模块与第三方jar",
|
||||
"type": "markdown",
|
||||
"path":"documentation"
|
||||
},
|
||||
|
||||
23
app/src/main/assets/help/documentation/模块与第三方jar.md
Normal file
23
app/src/main/assets/help/documentation/模块与第三方jar.md
Normal file
@@ -0,0 +1,23 @@
|
||||
### loadJar(path)
|
||||
* path \<String\> jar文件路径
|
||||
|
||||
载入jar文件。之后改文件的所有类均可直接使用。这在使用第三方库时十分方便。
|
||||
|
||||
### require(path)
|
||||
* path \<String\> js文件的相对路径
|
||||
|
||||
载入js文件并返回该模块。模块文件应该有module.exports语句指定模块的输出对象。
|
||||
|
||||
例如test.js:
|
||||
```
|
||||
function sayHello(name){
|
||||
print("Hello, " + name);
|
||||
}
|
||||
module.exports = sayHello;
|
||||
```
|
||||
同一个目录下的test_module.js:
|
||||
```
|
||||
var sayHello = require("test");
|
||||
sayHello("AutoJs");
|
||||
```
|
||||
运行这个脚本将在控制台输出"Hello, AutoJs"
|
||||
@@ -14,20 +14,34 @@ gravity
|
||||
weight
|
||||
|
||||
|
||||
var ui = {
|
||||
|
||||
};
|
||||
|
||||
ui.layout = function(xml){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
ui.layout(
|
||||
<linear orientation="vertical" w="fill" h="300" bg="#ff0000" gravity="center">
|
||||
<text text="测试" size="18" color="#000000"/>
|
||||
<linear orientation="vertical" w="fill" h="300" bg="#ff0000" gravity="center" layout_gravity="center">
|
||||
<text text="测试" size="18" color="#000000" id="adasd"/>
|
||||
<button id="btn" text="按钮"/>
|
||||
</linear>
|
||||
);
|
||||
|
||||
|
||||
|
||||
vat text = ui.asadsad;
|
||||
|
||||
<relative>
|
||||
|
||||
</relative>
|
||||
|
||||
<horizon>
|
||||
|
||||
</horiz>
|
||||
</horizon>
|
||||
|
||||
<vertical>
|
||||
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
log("Hello world!!!");
|
||||
toast("Hello, AutoJs!");
|
||||
openConsole();
|
||||
10
app/src/main/assets/sample/文件读写/写入文本文件.js
Normal file
10
app/src/main/assets/sample/文件读写/写入文本文件.js
Normal file
@@ -0,0 +1,10 @@
|
||||
//文件路径
|
||||
var path = "/sdcard/1.txt";
|
||||
//要写入的文件内容
|
||||
var text = "Hello, AutoJs";
|
||||
//以写入模式打开文件
|
||||
var file = open(path, "w");
|
||||
//写入文件
|
||||
file.write(text);
|
||||
//关闭文件
|
||||
file.close();
|
||||
20
app/src/main/assets/sample/文件读写/文件编码转换(高级).js
Normal file
20
app/src/main/assets/sample/文件读写/文件编码转换(高级).js
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
|
||||
convert("/sdcard/1.txt", "utf-8", "/sdcard/2.txt", "gbk");
|
||||
|
||||
/**
|
||||
* fromFile: 源文件路径
|
||||
* fromEncoding: 源文件编码
|
||||
* toFile: 输出文件路径
|
||||
* toEncoding: 输出文件编码
|
||||
*/
|
||||
function convert(fromFile, fromEncoding, toFile, toEncoding){
|
||||
fromFile = open(fromFile, "r", fromEncoding);
|
||||
toFile = open(toFile, "w", toEncoding);
|
||||
while(true){
|
||||
var line = fromFile.readline();
|
||||
if(!line)
|
||||
break;
|
||||
toFile.writeline(line);
|
||||
}
|
||||
}
|
||||
13
app/src/main/assets/sample/文件读写/文件编码转换.js
Normal file
13
app/src/main/assets/sample/文件读写/文件编码转换.js
Normal file
@@ -0,0 +1,13 @@
|
||||
//以UTF-8编码打开SD卡上的1.txt文件
|
||||
var in = open("/sdcard/1.txt", "r", "utf-8");
|
||||
//读取文件所有内容
|
||||
var text = in.read();
|
||||
//关闭文件
|
||||
in.close();
|
||||
//以gbk编码打开SD卡上的2.txt文件
|
||||
var out = open("/sdcard/2.txt", "w", "gbk");
|
||||
//写入内容
|
||||
out.write(text);
|
||||
//关闭文件
|
||||
out.close();
|
||||
|
||||
37
app/src/main/assets/sample/文件读写/读写文本文件.js
Normal file
37
app/src/main/assets/sample/文件读写/读写文本文件.js
Normal file
@@ -0,0 +1,37 @@
|
||||
//以写入模式打开SD卡根目录文件1.txt
|
||||
var file = open("/sdcard/1.txt", "w")
|
||||
//写入aaaa
|
||||
file.write("aaaa");
|
||||
//写入bbbbb后换行
|
||||
file.writeline("bbbbb");
|
||||
//写入ccc与ddd两行
|
||||
file.writelines(["ccc", "ddd"]);
|
||||
//关闭文件
|
||||
file.close();
|
||||
|
||||
//以附加模式打开文件
|
||||
file = open("/sdcard/1.txt", "a");
|
||||
//附加一行"啦啦啦啦"
|
||||
file.writeline("啦啦啦啦");
|
||||
//附加一行"哈哈哈哈"
|
||||
file.writeline("哈哈哈哈");
|
||||
//附加两行ccc, ddd
|
||||
file.writelines(["ccc", "ddd"]);
|
||||
//输出缓冲区
|
||||
file.flush();
|
||||
//关闭文件
|
||||
file.close();
|
||||
|
||||
|
||||
//以读取模式打开文件
|
||||
file = open("/sdcard/test.txt", "r")
|
||||
//读取一行并打印
|
||||
print(file.readline());
|
||||
//读取剩余所有行并打印
|
||||
for each(line in file.readlines()){
|
||||
print(line)
|
||||
}
|
||||
file.close()
|
||||
|
||||
//显示控制台
|
||||
console.show()
|
||||
11
app/src/main/assets/sample/文件读写/读取文本文件.js
Normal file
11
app/src/main/assets/sample/文件读写/读取文本文件.js
Normal file
@@ -0,0 +1,11 @@
|
||||
//文件路径
|
||||
var path = "/sdcard/1.txt";
|
||||
//打开文件
|
||||
var file = open(path);
|
||||
//读取文件的所有内容
|
||||
var text = file.read();
|
||||
//打印到控制台
|
||||
print(text);
|
||||
//关闭文件
|
||||
file.close();
|
||||
console.show();
|
||||
49
app/src/main/assets/sample/选择器/QQ空间点赞(不完美).js
Normal file
49
app/src/main/assets/sample/选择器/QQ空间点赞(不完美).js
Normal file
@@ -0,0 +1,49 @@
|
||||
"auto";
|
||||
|
||||
var 延迟 = 0;
|
||||
|
||||
function 点赞(){
|
||||
className("AbsListView").findOne()
|
||||
.children().each(function(ss){
|
||||
try{
|
||||
var 一行 = 找到图标那一行(ss);
|
||||
if(一行){
|
||||
一行.child(1).click();
|
||||
if(延迟 > 0){
|
||||
sleep(延迟);
|
||||
}
|
||||
}
|
||||
}catch(e){}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function 找到图标那一行(s){
|
||||
for(let i = 0; i < s.getChildCount(); i++){
|
||||
var child = s.child(i);
|
||||
if(child && child.className()
|
||||
.endsWith("RelativeLayout") &&
|
||||
child.getChildCount() >= 4){
|
||||
if(是图片(child.child(1)) &&
|
||||
是图片(child.child(2)) &&
|
||||
是图片(child.child(3))){
|
||||
return child;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function 是图片(item){
|
||||
return item &&
|
||||
item.className().endsWith("ImageView");
|
||||
}
|
||||
|
||||
function 下滑(){
|
||||
className("AbsListView").findOne()
|
||||
.scrollForward();
|
||||
}
|
||||
|
||||
while(true){
|
||||
点赞();
|
||||
下滑();
|
||||
}
|
||||
25
app/src/main/assets/sample/选择器/清空酷安动态.js
Normal file
25
app/src/main/assets/sample/选择器/清空酷安动态.js
Normal file
@@ -0,0 +1,25 @@
|
||||
"auto";
|
||||
|
||||
//清空酷安动态
|
||||
//需要酷安客户端支持
|
||||
//务必谨慎使用!!!
|
||||
//by dazhang32552732
|
||||
toast("正在启动酷安");
|
||||
launch("com.coolapk.market");
|
||||
sleep(2000);
|
||||
while(!click("酷市场"));
|
||||
while(!click("我"));
|
||||
while(!click("动态"));
|
||||
toast("请注意,即将开始删除酷安动态,这将不可恢复,请谨慎操作!");
|
||||
sleep(3000);
|
||||
toast("操作将在十秒后自动进行,请谨慎操作!");
|
||||
sleep(5000);
|
||||
toast("操作将在五秒后自动进行,请谨慎操作!");
|
||||
sleep(5000);
|
||||
toast("操作开始!");
|
||||
while(true){
|
||||
id("more_view").click();
|
||||
while(!click("删除"));
|
||||
while(!click("确定"));
|
||||
sleep(1000);
|
||||
}
|
||||
Reference in New Issue
Block a user