基于autojs的快手抖音多应用一起刷的脚本,多页面ui

1)运行实例截图

 

 

 

 

 

主要运行原理

autojs 是模拟人手点击等手机自动化软件。可用于制作自动化脚本。

1)主要是上划,加一些关键词判断(避免卡在一些“我知道了”页面上划不了)

2)复杂一点的地方是同时支持多个应用,多个页面的ui设计。部分的源代码展示如下,如需要全部代码,请留言或私信

上划代码很简单:

xishua_common.keeping_swipe = function(local_app_name,run_time,swipe_direction,swipe_time_min,swipe_time_max,swipe_time, click_back, click_words) {
    run_start_time = commonfunc.time_get_seconds()
    //获取当前时间
    commonfunc.log("将一直划动%d分钟", run_time)
    while(commonfunc.time_get_seconds() - run_start_time < run_time * 60) {//运行时间没有到
        if (commonfunc.app_get_current_app_name() == local_app_name) {
            xishua_common.error_handle(click_words) //此函数比较耗时,抖音极速版大概会有20秒左右
            if (swipe_direction == "上") {
                commonfunc.log("上划动")
                swipe(device.width * 0.52, device.height * 0.8, device.width * 0.48, device.height * 0.2, swipe_time)
            } else if (swipe_direction == "下"){
                commonfunc.log("下划动")
                swipe(device.width * 0.52, device.height * 0.2, device.width * 0.48, device.height * 0.8, swipe_time)
            } else if (swipe_direction == "左") {
                commonfunc.log("左划动")
                swipe(device.width * 0.8, device.height * 0.52, device.width * 0.2, device.height * 0.5, swipe_time)
            } else if (swipe_direction == "右") {
                commonfunc.log("右划动")
                swipe(device.width * 0.2, device.height * 0.52, device.width * 0.8, device.height * 0.5, swipe_time)
            } else {
                commonfunc.log("默认上划动")
                swipe(device.width * 0.52, device.height * 0.8, device.width * 0.48, device.height * 0.2, swipe_time)
            }
        }
        sleep_time = random(swipe_time_min, swipe_time_max)
        sleep(sleep_time * 1000)

        if (commonfunc.app_get_current_app_name() == local_app_name && click_back == true) {
            back()
            commonfunc.log("返回")
        } else {

        }
    }

    commonfunc.log(local_app_name+"运行时间到")

}

 

多ui页面代码如下:

"ui";
ui.layout(
    <drawer id="drawer">
        <vertical>
            <appbar>
                <toolbar bg="#FF5c50e6" id="toolbar" title="喜刷" paddingTop="2dp" h="auto" >
                    <button bg="#FF00CED1" id="start" layout_gravity="right" textColor="#ffffff" text="开始" style="Widget.AppCompat.Button.Borderless.Colored" w="auto" />
                </toolbar>
                <tabs id="tabs" />
            </appbar>
            <viewpager id="viewpager">
                <frame>
                 {/* 第一级 主页*/}    
                    <scroll>
                            <vertical>
                                <card>
                                <horizontal weightSum="4">
                                    <Switch id="autoService" text="无障碍服务" checked="{{auto.service != null}}" padding="8 8 8 8" textSize="15sp" layout_weight="2"/><Switch id="floatWindowPermission" text="悬浮窗权限" checked="{{floaty.checkPermission() == true}}" padding="8 8 8 8" textSize="15sp" layout_weight="2"/>
                                </horizontal>
                                </card>
                                <card>
                                <horizontal id="global_setting_1" weightSum="4">
                                    <text text="每个应用运行多久时间"  layout_weight="1"/><input id="run_time" inputType="number"  hint="分钟" layout_weight="1"/><text text="循环次数"  layout_weight="1"/><input id="repeat_time" inputType="number"  hint="循环" layout_weight="1"/>
                                </horizontal>
                                </card>
                                <card>
                                <horizontal id="click_words" weightSum="2">
                                    <text text="要点击的关键词"  layout_weight="1"/><input id="jump_word"  hint="多个关键词以@号分隔" layout_weight="1"/>
                                </horizontal>
                                </card>
                                <card>
                                <horizontal id="global_setting_2" weightSum="4">
                                    <text text="划动间隔最小时间"layout_weight="1"/><input id="swipe_time_min" inputType="number"   hint="秒" layout_weight="1"/><text text="最大时间" layout_weight="1"/><input id="swipe_time_max" inputType="number"  hint="秒" layout_weight="1"/>
                                </horizontal>
                                </card>
                                <card>
                                <horizontal weightSum="4">
                                    <text text="关闭视频" layout_weight="1"/><checkbox id="shutdown_video" layout_weight="1"/><text text="关闭声音" layout_weight="1"/><checkbox id="shutdown_audio" layout_weight="1"/> 
                                </horizontal>
                                </card>    
                                <card>
                                <horizontal weightSum="4">
                                    <text id="usage" text="用法说明视频"   layout_weight="1"/> 
                                </horizontal>
                                </card>                             
                            </vertical>
                    </scroll> 
                </frame>
                <frame>
                 {/* 第二级 已支持应用*/}    
                    <scroll>
                            <vertical>
                            <card  id="app_card_0" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_0"/><text id="app_name_0" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_0"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>
                            <card  id="app_card_1" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_1"/><text id="app_name_1" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_1"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>  
                            <card  id="app_card_2" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_2"/><text id="app_name_2" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_2"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>  
                            <card id="app_card_3" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_3"/><text id="app_name_3" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_3"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>  
                            <card id="app_card_4"  w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_4"/><text id="app_name_4" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_4"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>  
                            <card id="app_card_5" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_5"/><text id="app_name_5" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_5"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>             
                            <card id="app_card_6" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_6"/><text id="app_name_6" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_6"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>  
                            <card id="app_card_7" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_7"/><text id="app_name_7" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_7"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>
                            <card id="app_card_8" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                <vertical>
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_8"/><text id="app_name_8" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_8"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                </vertical>
                            </card>        
                            <card  id="app_card_9" w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                                
                                <horizontal weightSum="4">
                                    <checkbox id="app_is_run_9"/><text id="app_name_9" text="第一个应用" layout_weight="1"/><text text="运行时间"  layout_weight="1"/><input id="app_run_time_9"  hint="分钟" layout_weight="1"/>
                                </horizontal>
                                
                            </card> 
                            </vertical>
                    </scroll> 
                </frame>
                <frame>
                 {/* 第三级 高级用户*/}    
                    <scroll>
                            <vertical>
                            <card  w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                            <vertical>
                            <horizontal weightSum="4">
                                <checkbox id="cust_app_is_run_0"/><input id="cust_app_name_0"  layout_weight="1"/><text text="运行时间" layout_weight="1" /><input id="cust_app_run_time_0" hint="分钟" layout_weight="1"/>
                            </horizontal>
                            <horizontal weightSum="6">
                                <text text="划动方向" layout_weight="1"/><input id="cust_app_direction_0"  hint="上下左右" layout_weight="1"/><text text="速度" layout_weight="1"/><input id="cust_app_speed_0"  hint="1到10" layout_weight="1"/><checkbox text="是否返回" id="cust_app_click_back_0"  layout_weight="1"/>
                            </horizontal>
                            </vertical>
                            </card>

                            <card  w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                            <vertical>
                            <horizontal weightSum="4">
                                <checkbox id="cust_app_is_run_1"/><input id="cust_app_name_1"  layout_weight="1"/><text text="运行时间" layout_weight="1" /><input id="cust_app_run_time_0" hint="分钟" layout_weight="1"/>
                            </horizontal>
                            <horizontal weightSum="6">
                                <text text="划动方向" layout_weight="1"/><input id="cust_app_direction_1"  hint="上下左右" layout_weight="1"/><text text="速度" layout_weight="1"/><input id="cust_app_speed_1"  hint="1到10" layout_weight="1"/><checkbox text="是否返回" id="cust_app_click_back_1"  layout_weight="1"/>
                            </horizontal>
                            </vertical>
                            </card>                             

                            <card  w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                            <vertical>
                            <horizontal weightSum="4">
                                <checkbox id="cust_app_is_run_2"/><input id="cust_app_name_2"  layout_weight="1"/><text text="运行时间" layout_weight="1" /><input id="cust_app_run_time_0" hint="分钟" layout_weight="1"/>
                            </horizontal>
                            <horizontal weightSum="6">
                                <text text="划动方向" layout_weight="1"/><input id="cust_app_direction_2"  hint="上下左右" layout_weight="1"/><text text="速度" layout_weight="1"/><input id="cust_app_speed_2"  hint="1到10" layout_weight="1"/><checkbox text="是否返回" id="cust_app_click_back_2"  layout_weight="1"/>
                            </horizontal>
                            </vertical>
                            </card>

                            <card  w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                            <vertical>
                            <horizontal weightSum="4">
                                <checkbox id="cust_app_is_run_3"/><input id="cust_app_name_3"  layout_weight="1"/><text text="运行时间" layout_weight="1" /><input id="cust_app_run_time_0" hint="分钟" layout_weight="1"/>
                            </horizontal>
                            <horizontal weightSum="6">
                                <text text="划动方向" layout_weight="1"/><input id="cust_app_direction_3"  hint="上下左右" layout_weight="1"/><text text="速度" layout_weight="1"/><input id="cust_app_speed_3"  hint="1到10" layout_weight="1"/><checkbox text="是否返回" id="cust_app_click_back_3"  layout_weight="1"/>
                            </horizontal>
                            </vertical>
                            </card>

                            <card  w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                            <vertical>
                            <horizontal weightSum="4">
                                <checkbox id="cust_app_is_run_4"/><input id="cust_app_name_4"  layout_weight="1"/><text text="运行时间" layout_weight="1" /><input id="cust_app_run_time_4" hint="分钟" layout_weight="1"/>
                            </horizontal>
                            <horizontal weightSum="6">
                                <text text="划动方向" layout_weight="1"/><input id="cust_app_direction_4"  hint="上下左右" layout_weight="1"/><text text="速度" layout_weight="1"/><input id="cust_app_speed_4"  hint="1到10" layout_weight="1"/><checkbox text="是否返回" id="cust_app_click_back_4"  layout_weight="1"/>
                            </horizontal>
                            </vertical>
                            </card>
                            </vertical>
                    </scroll> 
                </frame>

                <frame>
                 {/* 第四页 调试和帮助*/}    
                    <scroll>
                            <vertical>
                                
                            </vertical>
                    </scroll> 
                </frame>
            </viewpager>
        </vertical>
    </drawer>
    
)

每个支持的应用顺序执行,时间到后退出,进行下一个应用:

            i = 0
            while(i < run_supported_app_array.length) {
                commonfunc.log("运行"+run_supported_app_array[i].name)
                for (j = 0; j < supported_app_array.length; j++) {
                    if (run_supported_app_array[i].name == supported_app_array[j].name) {
                        //寻找到了默认的支持的应用,划动的速度是每次划动500ms
                        supported_app_array[j].script.watch_video(run_supported_app_array[i].run_time,
                            Number(swipe_time_min_val),Number(swipe_time_max_val),5*100,mute_audio,mute_video,jump_word_array)
                        break
                    }
                }
                commonfunc.log("结束"+run_supported_app_array[i].name)
                if (commonfunc.app_get_current_app_name() == run_supported_app_array[i].name) {
                    home()
                }
                sleep(2000)
                i = i + 1
            }

由于代码量比较大,贴出部分代码。

另外自己封装了一些常用函数在common.js。这样就能提高复用度。且不容易出错,需要引用的时候只需要执行:

commonfunc = require(PROJECT_ROOT + "common.js")

封装的函数代码有:

注释也写得比较清楚,可以大量减少开发时间

//等待某个符合条件的控件出现,不使用平台的waitfor和untilFind,是因为这两个操作是阻塞的。默认等待10s
common.widget_wait_timeout = function(selector_conditions, log_info, time) {
    if (!time) {
        time = 10000
    }
    find = selector_conditions.visibleToUser(true).findOne(time)
    //findOne返回控件或者null
    if (find) {
        if (log_info)
            common.log("等到了" + log_info)
        return find
        //返回控件,方便后续操作
    } else {
        if (log_info)
            common.log("等不到" + log_info)
        return null
    }
}


//利用n的bounds转化为有超时时间的等待
//等待widget在某个父widget区域内出现
common.widget_wait_timeout_in_widget = function(n, selector_conditions, log_info, time) {
    b = n.bounds()
    v = common.widget_wait_timeout(selector_conditions.boundsInside(b.left,b.top,b.right,b.bottom), null, time)
    if (v) {
        if (log_info) {
            common.log("等到" + log_info)
        }
        return v
        //返回控件,方便后续操作
    } else {
        if (log_info) {
            common.log("无法等到" + log_info)
        }
        return null
    }
}

 

喜刷简介:

  1. 可以运行 快手极速版,抖音极速版,抖音火山版,微视等应用。
  2. 可以使手机显示黑屏画面,更加省电
  3. 也可以静音
### 回答1: Autojs是一款安卓平台的自动化工具,它可以模拟人类手指的操作,实现自动化的流程和任务。而抖私信脚本则是基于Autojs开发的应用程序之一,通过脚本编写的方式,实现了在抖应用中发送私信的自动化操作。 这个脚本的主要功能是在使用抖时,对于一些特定的用户或关键词,自动发送私信。用户可以通过脚本代码进行配置相关的操作规则和收件人等内容。例如,用户可以设置自动发送私信的内容、发送时间,还可以设置是否与其他脚本联动等等。 抖私信脚本的使用也十分简单。用户只需安装Autojs应用和脚本应用,打开抖APP,运行脚本程序即可。使用该应用可以有效提高私信发送任务的效率,并且不需要使用者长时间维护应用程序。但是,在使用自动化脚本时,需要注意规避违反应用规则和用户隐私等问题,以免受到法律风险和用户纠纷的影响。 总之,抖私信脚本在提高私信发送效率的同时,也在一定程度上解放了用户的行动力,是一款非常实用的应用程序。 ### 回答2: AutoJS是一款适用于Android操作系统的自动化脚本工具,它结合了JavaScript和Android API的优势,可以让用户通过编写脚本,完成一系列自动化操作。而抖私信脚本,则是基于AutoJS开发的一款抖自动化工具,可以用来发送私信、点赞、评论、关注等操作。 使用抖私信脚本,首先需要在手机上安装AutoJS应用,并为其授权相应的权限。然后,用户需要编写一份JavaScript脚本,以实现发送私信的功能。具体实现过程包括模拟用户点击抖应用的界面、输入私信内容、选择发送对象、点击发送等操作。 目前,随着社交媒体的普及和人们对效率的要求日益提高,自动化工具的应用越来越广泛。而抖私信脚本,则可以帮助用户速高效地处理私信内容,提升社交媒体营销的效率。但需要注意的是,使用自动化工具应当遵守相关规定和道德准则,并避免出现违反用户协议等问题。
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值