企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# autojs悬浮窗以及url访问 ``` <pre class="calibre15">``` <span class="token3">auto</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token3">setInterval</span><span class="token1">(</span><span class="token1">(</span><span class="token1">)</span>\<span class="token">=></span><span class="token1">{</span><span class="token1">}</span><span class="token1">,</span> <span class="token5">1000</span><span class="token1">)</span><span class="token1">;</span> varw <span class="token">=</span> floaty<span class="token1">.</span><span class="token3">window</span><span class="token1">(</span> <span class="token1">)</span><span class="token1">;</span> w<span class="token1">.</span><span class="token3">setAdjustEnabled</span><span class="token1">(</span><span class="token5">true</span><span class="token1">)</span><span class="token1">;</span> <span class="token6">//悬浮窗点击</span> w<span class="token1">.</span>action<span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token2">function</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span> <span class="token2">if</span><span class="token1">(</span>w<span class="token1">.</span>action<span class="token1">.</span><span class="token3">getText</span><span class="token1">(</span><span class="token1">)</span><span class="token">==</span><span class="token4">"启动"</span><span class="token1">)</span><span class="token1">{</span> w<span class="token1">.</span>action<span class="token1">.</span><span class="token3">setText</span><span class="token1">(</span><span class="token4">"停止"</span><span class="token1">)</span><span class="token1">;</span> threads<span class="token1">.</span><span class="token3">start</span><span class="token1">(</span>功能<span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span><span class="token2">else</span><span class="token1">{</span> threads<span class="token1">.</span><span class="token3">shutDownAll</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> w<span class="token1">.</span>action<span class="token1">.</span><span class="token3">setText</span><span class="token1">(</span><span class="token4">"启动"</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">function</span><span class="token3">功能</span><span class="token1">(</span><span class="token1">)</span><span class="token1">{</span> <span class="token6">//复制连接</span> varlist <span class="token">=</span><span class="token3"> className</span><span class="token1">(</span><span class="token4">'android.widget.TextView'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">depth</span><span class="token1">(</span><span class="token5">9</span><span class="token1">)</span><span class="token1">.</span><span class="token3">drawingOrder</span><span class="token1">(</span><span class="token5">3</span><span class="token1">)</span><span class="token1">.</span><span class="token3">findOne</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> list<span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">for</span><span class="token1">(</span>vari\<span class="token">=</span><span class="token5">0</span><span class="token1">;</span>i<span class="token"><</span><span class="token5">6</span><span class="token1">;</span>i<span class="token">++</span><span class="token1">)</span><span class="token1">{</span> <span class="token3">sleep</span><span class="token1">(</span><span class="token5">1000</span><span class="token1">)</span><span class="token1">;</span> varadress <span class="token">=</span><span class="token3"> className</span><span class="token1">(</span><span class="token4">'android.widget.ImageView'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">id</span><span class="token1">(</span><span class="token4">'com.taobao.taobao:id/share\_channel\_item\_image'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">findOnce</span><span class="token1">(</span><span class="token5">5</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span><span class="token1">(</span>adress<span class="token">!=</span><span class="token2">null</span><span class="token1">)</span><span class="token1">{</span> <span class="token3">sleep</span><span class="token1">(</span><span class="token5">1000</span><span class="token1">)</span><span class="token1">;</span> <span class="token3">click</span><span class="token1">(</span>adress<span class="token1">.</span><span class="token3">bounds</span><span class="token1">(</span><span class="token1">)</span><span class="token1">.</span><span class="token3">centerX</span><span class="token1">(</span><span class="token1">)</span><span class="token1">,</span>adress<span class="token1">.</span><span class="token3">bounds</span><span class="token1">(</span><span class="token1">)</span><span class="token1">.</span><span class="token3">centerY</span><span class="token1">(</span><span class="token1">)</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">break</span><span class="token1">;</span> <span class="token1">}</span> <span class="token1">}</span> <span class="token6">//获取剪切板连接</span> varfenxiang <span class="token">=</span><span class="token3"> getClip</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token3">log</span><span class="token1">(</span><span class="token4">"47.104.183.209?s=App.Test.getLink&tao="</span><span class="token">+</span>fenxiang<span class="token1">)</span> varresponse <span class="token">=</span> http<span class="token1">.</span><span class="token2">get</span><span class="token1">(</span><span class="token4">"47.104.183.209?s=App.Test.getLink&tao="</span><span class="token">+</span>fenxiang<span class="token1">)</span><span class="token1">;</span> varobj <span class="token">=</span> response<span class="token1">.</span>body<span class="token1">.</span><span class="token3">json</span><span class="token1">(</span><span class="token1">)</span> <span class="token2">var</span>口令 <span class="token">=</span> obj\<span class="token1">[</span><span class="token4">'data'</span>\<span class="token1">]</span><span class="token1">.</span>tpwd <span class="token3">log</span><span class="token1">(</span><span class="token4">"响应: "</span> <span class="token">+</span>口令<span class="token1">)</span><span class="token1">;</span> <span class="token3">setClip</span><span class="token1">(</span>口令<span class="token1">)</span><span class="token1">;</span> <span class="token3">back</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token2">if</span><span class="token1">(</span>口令<span class="token1">)</span><span class="token1">{</span> <span class="token3">home</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token3">sleep</span><span class="token1">(</span><span class="token5">1000</span><span class="token1">)</span><span class="token1">;</span> <span class="token3">setClip</span><span class="token1">(</span>口令<span class="token1">)</span><span class="token1">;</span> <span class="token3">click</span><span class="token1">(</span><span class="token4">'手机淘宝'</span><span class="token1">,</span><span class="token5">0</span><span class="token1">)</span><span class="token1">;</span> varopen <span class="token">=</span><span class="token3"> className</span><span class="token1">(</span><span class="token4">'android.widget.TextView'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">text</span><span class="token1">(</span><span class="token4">'打开'</span><span class="token1">)</span><span class="token1">.</span><span class="token3">findOne</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> open<span class="token1">.</span><span class="token3">click</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span><span class="token2">else</span><span class="token1">{</span> <span class="token3">toast</span><span class="token1">(</span><span class="token4">'未查询到优惠券'</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> threads<span class="token1">.</span><span class="token3">shutDownAll</span><span class="token1">(</span><span class="token1">)</span><span class="token1">;</span> w<span class="token1">.</span>action<span class="token1">.</span><span class="token3">setText</span><span class="token1">(</span><span class="token4">"启动"</span><span class="token1">)</span><span class="token1">;</span> <span class="token1">}</span> ``` ```