[JavaScript] 纯文本查看 复制代码
"ui";
ui.layout(
<frame>
<ScrollView>
<vertical h="auto" w="*">
<card w="*" margin="10 5" h="70" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical h="auto" w="*">
<text paddingLeft="20" paddingTop="16" text="TikToK自动化脚本" w="auto" textSize="16sp" textColor="#000000"/>
<text paddingLeft="20" paddingBottom="16" text="unsoft出品" w="auto"/>
</vertical>
<View bg="#f44336" h="auto" w="10"/>
</card>
<card w="*" margin="10 5" h="250" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical h="auto" w="*">
<horizontal>
<text paddingLeft="20" paddingTop="16" text="自动关注设置" w="auto" textColor="#000000"/>
</horizontal>
<horizontal>
<text paddingLeft="20" text="关注间隔" w="auto" />
<input id="bmiao" inputType="number" text="2" w="50" gravity="center"/>
<text text="秒至" w="auto"/>
<input id="emiao" inputType="number" text="5" w="50" gravity="center"/>
<text text="秒" w="auto"/>
</horizontal>
<horizontal>
<text paddingLeft="20" text="每作品关注" w="auto"/>
<input id="zpnumb" inputType="number" text="200" w="50" gravity="center"/>
<text text="个粉丝" w="auto"/>
</horizontal>
<horizontal>
<text paddingLeft="20" text="总共关注" w="auto"/>
<input id="allnumb" inputType="number" text="200" w="50" gravity="center"/>
<text text="个粉丝" w="auto"/>
</horizontal>
<horizontal padding="20">
<button id="btn_gz" w="*" text="开始关注" gravity="center" bg="#409EFF" textColor="#ffffff"/>
</horizontal>
</vertical>
<View bg="#FFA500" h="auto" w="10"/>
</card>
<card w="*" margin="10 5" min-h="250" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical h="auto" w="*">
<horizontal>
<text paddingLeft="20" paddingTop="16" text="自动私信设置" w="auto" textColor="#000000"/>
</horizontal>
<horizontal paddingRight="20">
<text paddingLeft="20" text="私信一:" w="auto" />
<input id="fst" w="*"/>
</horizontal>
<horizontal paddingRight="20">
<text paddingLeft="20" text="私信二:" w="auto" />
<input id="sec" w="*" />
</horizontal>
<horizontal paddingRight="20">
<text paddingLeft="20" text="私信三:" w="auto" />
<input id="thr" w="*" />
</horizontal>
<horizontal padding="20">
<button id="btn_sx" w="*" text="开始私信" gravity="center" bg="#409EFF" textColor="#ffffff"/>
</horizontal>
</vertical>
<View bg="#4caf50" h="auto" w="10"/>
</card>
</vertical>
</ScrollView>
</frame>
);
var fuhao=[""," "," ",".",". ",". ","。","。 ","!","! ","!",",", ", ",","];
var pics=["1","2","3","4"]; //注意,这里是表情字符串,但是论坛不允许发,否则帖子发不出去,所以替换成了1234.
function flo()
{
var w = floaty.rawWindow(
<frame gravity="center">
<text id="flt" text="Stop" textSize="16sp" textColor="red"/>
</frame>
);
w.setPosition(0, 500);
w.flt.click(function(){
//停止所有脚本
threads.start(endprocess);
}
);
}
function main_gz()
{
auto.waitFor();
console.show();
//flo();
var int_bmiao=parseInt(ui.bmiao.getText());//起始秒数
var int_emiao=parseInt(ui.emiao.getText());//结束秒数
var int_zpnumb=parseInt(ui.zpnumb.getText());//每作品关注人数
var int_allnumb=parseInt(ui.allnumb.getText());//总计关注人数
var i=0;
var j=0;
toast("开启关注程序!");
launchApp("TikTok");
//sleep(3000);
//click(106,1700);
sleep(4000);
while(i<int_allnumb)
{
click(985,560);
sleep(2000);
var user=id("aol").findOne();
sleep(2000);
click(user.bounds().centerX(),user.bounds().centerY());
sleep(2000);
m=0;
while(m<int_zpnumb)
{
var follow=id("s3").find();
sleep(800)
console.log("找到点击目标");
for(n=0;n<follow.length;n++)
{
var txt=follow[n].text();
if(txt=="Follow" && m<int_zpnumb && follow[n].bounds().centerY()<1789 && follow[n].bounds().centerY()>360)
{
click(follow[n].bounds().centerX(),follow[n].bounds().centerY());
var rdm=random(int_bmiao,int_emiao);
sleep(rdm*1000);
console.log("正在点击...");
m++;
i++;
}
}
sleep(2000);
swipe(540,1618,540,330,1000);
sleep(2000)
}
back();
sleep(1000);
back();
sleep(2000);
swipe(540,1618,540,330,500);
sleep(2000);
}
toast("程序结束!");
}
ui.btn_gz.click(function(){
//开始关注
threads.start(main_gz);
});
ui.btn_sx.click(function(){
//开始私信
threads.start(main_sx);
}
);
function endprocess()
{
engines.stopAll();
floaty.closeAll();
toast("程序结束!");
}
function main_sx()
{
auto.waitFor();
console.show();
//flo();
var fsts=ui.fst.getText();//私信一
var ssecs=ui.sec.getText();//私信二
var thrs=ui.thr.getText();//私信三
var str_fst=String(fsts);
var str_sec=String(ssecs);
var str_thr=String(thrs);
toast("开启私信程序!");
launchApp("TikTok");
sleep(2000);
click(754,1700);
sleep(2000);
while(true){
var msg=id("s3").find();
console.log("找到目标");
sleep(800);
for(n=0;n<msg.length;n++)
{
stat=1;
if(msg[n].bounds().centerY()<1603 && msg[n].bounds().centerY()>240 && msg[n].text()=="Message")
{
click(msg[n].bounds().centerX(),msg[n].bounds().centerY());
}
else
{
continue;
}
console.log("正在点击...");
sleep(1000);
var istxt=id("bsa").findOnce();
sleep(800);
if(istxt!=null)
{
console.log("已经发过了");
stat=2;
sleep(1000);
}
/*
var cud=id("cud").findOnce();
sleep(800);
if(cud!=null)
{
console.log("被封号了");
engines.stopAll();
stat=2;
sleep(1000);
}
*/
if(stat==1)
{
if(str_fst!="")
{
console.log("发送第一句");
var nb=parseInt(random(0,fuhao.length));
var picnb=parseInt(random(0,pics.length));
//var str_fst_txt=str_fst+fuhao[nb]+pics[picnb];
var str_fst_txt=str_fst+" "+pics[picnb];
id("bs8").setText(str_fst_txt);
sleep(1000);
id("cli").findOne().click();
sleep(1000)
}
if(str_sec!="")
{
console.log("发送第二句");
var nb=parseInt(random(0,fuhao.length));
var picnb=parseInt(random(0,pics.length));
//var str_sec_txt=str_sec+fuhao[nb]+pics[picnb];
var str_sec_txt=str_sec+" "+pics[picnb];
id("bs8").findOne().setText(str_sec_txt);
sleep(1000);
id("cli").findOne().click();
sleep(1000)
}
if(str_thr!="")
{
console.log("发送第三句");
var nb=parseInt(random(0,fuhao.length));
var picnb=parseInt(random(0,pics.length));
//var str_thr_txt=str_thr+fuhao[nb]+pics[picnb];
var str_thr_txt=str_thr+" "+pics[picnb];
id("bs8").findOne().setText(str_thr_txt);
sleep(1000);
id("cli").findOne().click();
sleep(1000)
}
}
sleep(1000);
back();
sleep(1000);
}
swipe(540,1618,540,350,500);
sleep(2000);
}
}