当前位置:网站首页>Auto. JS to automatically authorize screen capture permission
Auto. JS to automatically authorize screen capture permission
2022-06-24 21:23:00 【C colony】
Write it at the front :
This article records my own development process , Basic problems encountered , It is also convenient for future development .
If you're a beginner Auto.js Development , I suggest you read this article Auto.js introduction 【 Hyperbasic 】, This article is the work I read when I started , Overall, I felt very good , The basic content has been mentioned , It is completely suitable for novices to make some simple scripts for their own use .
One 、 Developing documents
This method is also mentioned in the development documentation , Some systems do not have the option to always allow , The subject also encountered this problem , Because the written script runs regularly , It is impossible to authorize manually by yourself , So I wrote an automatic authorization method , There are many deficiencies , I hope you can correct .
Two 、 Advanced method
1、 Define methods ( Personal recommendation only )
I usually choose to open a new one js file , Store some convenient functions defined by myself separately , When developed in this way , I just need to copy the file to the folder , You can call all the functions defined by me .
2、 Code
function getScreenCapture(){
let Thread = threads.start(function(){
if(auto.service != null){ // If you have obtained accessibility
// Due to the different authorization texts between systems , Use regular expressions
let Allow = textMatches(/( allow | Start immediately | Unified )/).findOne(10*1000);
if(Allow){
Allow.click();
}
}
});
if(!requestScreenCapture()){
log(" Failed to request screenshot permission ");
return false;
}else{
Thread.interrupt()
log(" Obtained screenshot permission ");
return true;
}
}
Here I mainly use Multithreading and Regular expressions To write this code , If you don't understand, you can read the development documents :Auto.js official API Document gate , Of course, some parts of the development documents are vague , If you are new to these two functions, you may not understand them , You can search some tutorials by yourself , You can also confide in me , Recommend .
3、 Calling method
var mydefine = require("MydefineFun.js");
stay main.js Method can be used to receive the export , And then use mydefine You can call methods , among MydefineFun.js Is the file name where the method is written .
Four 、 Last
1、 What's wrong , Welcome to discuss .
2、 If you have any questions, please let me know , You can also pay attention to me , We will update other advanced methods later .
边栏推荐
- Common self realization functions in C language development
- Use of kubernetes storage volumes
- Wechat applet custom tabbar
- Format method and parse method of dateformat class
- After screwing the screws in the factory for two years, I earned more than 10000 yuan a month by "testing" and counterattacked
- 海泰前沿技术|隐私计算技术在医疗数据保护中的应用
- Leetcode (146) - LRU cache
- Three more days
- What are the problems with traditional IO? Why is zero copy introduced?
- Pytest test framework II
猜你喜欢
CondaValueError: The target prefix is the base prefix. Aborting.
基于C语言实现的足球信息查询系统 课程报告+项目源码+演示PPT+项目截图
After 5 months' test, it took 15K to come for an interview. When I asked, it was not worth even 5K. It was really
Static routing job supplement
After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
Record a deletion bash_ Profile file
Am, FM, PM modulation technology
Power apps Guide
OSI notes sorting
Nifi fast authentication configuration
随机推荐
Microsoft Certification (dynamic 365) test
Enjoy yuan mode -- a large number of flying dragons
Intermediary model -- collaboration among departments
Background operation retry gave up; KeeperErrorCode = ConnectionLoss
畅直播|针对直播痛点的关键技术解析
Adding subscribers to a list using mailchimp's API V3
Dijkstra seeking secondary short circuit (easy to understand)
Why do we always "give up halfway"?
Network security review office starts network security review on HowNet
Builder mode -- Master asked me to refine pills
Logical backup: mysqldump vs physical backup: xtrabackup
Alibaba cloud schedules tasks and automatically releases them
A/B测试助力游戏业务增长
188. 买卖股票的最佳时机 IV
Simpledateformat thread unsafe
JMeter installation plug-in, adding [email protected] -Perfmon metric collector listener steps
B站带货当学新东方
Markdown use
Grating diffraction
Summary of message protocol problems