fix and add some scripts
This commit is contained in:
@@ -9,8 +9,8 @@ android {
|
|||||||
applicationId "com.stardust.scriptdroid"
|
applicationId "com.stardust.scriptdroid"
|
||||||
minSdkVersion 17
|
minSdkVersion 17
|
||||||
targetSdkVersion 23
|
targetSdkVersion 23
|
||||||
versionCode 152
|
versionCode 153
|
||||||
versionName "2.0.15 Alpha"
|
versionName "2.0.15 Beta"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
ndk {
|
ndk {
|
||||||
|
|||||||
@@ -8,6 +8,21 @@
|
|||||||
|
|
||||||
events也是一个\[EventEmitter\](#EventEmitter),可以使用EventEmitter的所有函数,这里只介绍其自身的函数。
|
events也是一个\[EventEmitter\](#EventEmitter),可以使用EventEmitter的所有函数,这里只介绍其自身的函数。
|
||||||
|
|
||||||
|
注意,events内置的触摸、按键事件必须调用loop()函数才能正常工作。例如:
|
||||||
|
```
|
||||||
|
events.observeKey();
|
||||||
|
events.onKeyDown("volume_up", function(event){
|
||||||
|
toast("音量上键被按下了");
|
||||||
|
});
|
||||||
|
events.onKeyDown("menu", function(event){
|
||||||
|
toast("菜单键被按下了");
|
||||||
|
});
|
||||||
|
|
||||||
|
loop();
|
||||||
|
//后面的语句不会再执行了
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
### events.emitter()
|
### events.emitter()
|
||||||
|
|
||||||
返回一个新的EventEmitter。
|
返回一个新的EventEmitter。
|
||||||
@@ -18,25 +33,6 @@ events也是一个\[EventEmitter\](#EventEmitter),可以使用EventEmitter的
|
|||||||
|
|
||||||
在安卓4.3以上才能使用。
|
在安卓4.3以上才能使用。
|
||||||
|
|
||||||
### events.loop()
|
|
||||||
|
|
||||||
开始事件处理循环。**在events注册按键、触摸事件监听后必须调用该函数开始事件处理循环,否则相应事件发生时不会处理。**
|
|
||||||
|
|
||||||
该函数是一个"死循环",调用后后面的语句将不再执行。
|
|
||||||
|
|
||||||
例子:
|
|
||||||
```
|
|
||||||
events.observeKey();
|
|
||||||
events.onKeyDown("volume_up", function(event){
|
|
||||||
toast("音量上键被按下了");
|
|
||||||
});
|
|
||||||
events.onKeyDown("menu", function(event){
|
|
||||||
toast("菜单键被按下了");
|
|
||||||
});
|
|
||||||
events.loop();
|
|
||||||
//后面的语句不会再执行了
|
|
||||||
```
|
|
||||||
|
|
||||||
### events.onKeyDown(keyName, listener)
|
### events.onKeyDown(keyName, listener)
|
||||||
* keyName \<String\> 要监听的按键名称
|
* keyName \<String\> 要监听的按键名称
|
||||||
* listener \<Function\> 参数为一个[KeyEvent](#KeyEvent)
|
* listener \<Function\> 参数为一个[KeyEvent](#KeyEvent)
|
||||||
|
|||||||
@@ -7,5 +7,4 @@ sleep(500);
|
|||||||
while(true){
|
while(true){
|
||||||
setText("我喜欢你");
|
setText("我喜欢你");
|
||||||
click("发送");
|
click("发送");
|
||||||
sleep(100);
|
|
||||||
}
|
}
|
||||||
10
app/src/main/assets/sample/QQ与微信/自动取消金豆.js
Normal file
10
app/src/main/assets/sample/QQ与微信/自动取消金豆.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
"auto";
|
||||||
|
|
||||||
|
toast("本脚本需要和名片点赞脚本同时运行才有效");
|
||||||
|
|
||||||
|
while(true){
|
||||||
|
if(currentActivity() == "com.tencent.mobileqq.activity.VisitorsActivity"){
|
||||||
|
click("取消");
|
||||||
|
sleep(300);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,39 +2,48 @@
|
|||||||
|
|
||||||
launchApp("百度贴吧");
|
launchApp("百度贴吧");
|
||||||
sleep(1000);
|
sleep(1000);
|
||||||
while(!click("进吧"));
|
id("tabcontainer").untilFind().each(function(tab){
|
||||||
|
if(tab.childCount() != 5){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ba = tab.child(1);
|
||||||
|
if(ba){
|
||||||
|
ba.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
toast("开始签到");
|
toast("开始签到");
|
||||||
var signed = {};
|
var signed = {};
|
||||||
|
|
||||||
while(true){
|
while(true){
|
||||||
var list = id("fragment_pager").findOne().findOne(id("listview"));
|
var list = id("tab_content").findOne().findOne(id("listview"));
|
||||||
list.children().each(function(child){
|
list.children().each(function(child){
|
||||||
if(child && child.className().endsWith("RelativeLayout")){
|
if(child && child.className().endsWith("LinearLayout")){
|
||||||
if(child.childCount() > 1){
|
if(child.childCount() > 1){
|
||||||
sign(child);
|
sign(child.findOne(id("left_container")));
|
||||||
|
sign(child.findOne(id("right_container")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
list.scrollForward();
|
list.scrollForward();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sign(child){
|
function sign(c){
|
||||||
var li = child.child(1);
|
if(!c){
|
||||||
if(li && li.childCount() > 0){
|
return;
|
||||||
var name = li.child(0).text();
|
}
|
||||||
if(signed[name]){
|
var name = c.child(0).text();
|
||||||
return;
|
if(signed[name]){
|
||||||
}
|
return;
|
||||||
child.click();
|
}
|
||||||
sleep(400);
|
c.click();
|
||||||
for(var i = 0; i < 3; i ++){
|
sleep(400);
|
||||||
if(click("签到")){
|
for(var i = 0; i < 3; i ++){
|
||||||
break;
|
if(click("签到")){
|
||||||
}
|
break;
|
||||||
sleep(200);
|
|
||||||
}
|
|
||||||
sleep(400);
|
|
||||||
while(!back());
|
|
||||||
signed[name] = true;
|
|
||||||
}
|
}
|
||||||
|
sleep(200);
|
||||||
|
}
|
||||||
|
sleep(600);
|
||||||
|
while(!back());
|
||||||
|
signed[name] = true;
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="_app_name">AutoJs</string>
|
<string name="_app_name">Auto.js</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="text_accessibility_service_description">Required by the script automatic operation (click, long press, slide, etc.).</string>
|
<string name="text_accessibility_service_description">Required by the script automatic operation (click, long press, slide, etc.).</string>
|
||||||
<string name="text_new_file">New File</string>
|
<string name="text_new_file">New File</string>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<string name="_app_name">AutoJs</string>
|
<string name="_app_name">Auto.js</string>
|
||||||
<string name="action_settings">设置</string>
|
<string name="action_settings">设置</string>
|
||||||
<string name="text_new_file">新建文件</string>
|
<string name="text_new_file">新建文件</string>
|
||||||
<string name="text_import_from_file">从文件导入</string>
|
<string name="text_import_from_file">从文件导入</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user