当前位置:网站首页>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 .
边栏推荐
- Memo mode - game archiving
- Postman assertion
- Read all text from stdin to a string
- Learn to use a new technology quickly
- A/B测试助力游戏业务增长
- I feel that I am bald again when I help my children with their homework. I feel pity for my parents all over the world
- Reflect package
- Alibaba cloud schedules tasks and automatically releases them
- GDB debugging
- PHP script calls command to get real-time output
猜你喜欢

Postman assertion

Appium introduction and environment installation
[email protected] -Perfmon metric collector listener steps"/>JMeter installation plug-in, adding [email protected] -Perfmon metric collector listener steps

Alibaba cloud schedules tasks and automatically releases them

Curl command

Oauth1.0 introduction

Grating diffraction

A/B测试助力游戏业务增长

Return of missing persons

Php-pdo parameter binding problem
随机推荐
opds sql组件能不能将流程参数通过上下文传给下一个组件
NPM download speed is slow
[cloud native learning notes] learn about kubernetes' pod
More than ten years' work experience is recommended at the bottom of the box: how much does it cost to find a job? See here! Brothers and sisters are recommended to collect and pay attention
Open function
Agency mode -- Jiangnan leather shoes factory
基于STM32的物联网下智能化养鱼鱼缸控制控制系统
Packaging_ Conversion between basic type and string type
Hongxiang Yunteng is compatible with dragon lizard operating system, and the product runs stably
Intermediary model -- collaboration among departments
database/sql
Jar package operation
Markdown use
Introduction to interval DP
Second understanding permutation and combination
Reflection - class object function - get method (case)
How to apply agile development ideas to other work
Basic database syntax learning
Physical layer introduction
Memo mode - game archiving