当前位置:网站首页>AutoJs学习-密码生成器
AutoJs学习-密码生成器
2022-08-02 09:02:00 【芝麻粒儿】
关于作者
众所周知,人生是一个漫长的流程,不断克服困难,不断反思前进的过程。在这个过程中会产生很多对于人生的质疑和思考,于是我决定将自己的思考,经验和故事全部分享出来,以此寻找共鸣 !!!
专注于Android/Unity和各种游戏开发技巧,以及各种资源分享(网站、工具、素材、源码、游戏等)
有什么需要欢迎私我,交流群让学习不再孤单。

本文约2.5千字,新手阅读需要7分钟,复习需要2分钟 【收藏随时查阅不再迷路】
实践过程
ui.layout(
<vertical background="http://1.119.192.186:8088/img/bg1.jpg">
<vertical>
<text w="*" h="56" gravity="center" color="#4D3D26" size="24sp" textStyle="bold">复杂密码生成器</text>
</vertical>
<vertical marginTop="13">
<text marginLeft="16" color="#1E1E1E" size="18sp" textStyle="bold">设置要生成密码的长度和数量</text>
<linear>
<input id="passlength" paddingLeft="5" inputType="number" maxLength = "2" marginTop="8" singleLine="true" marginLeft="16" h="*" w="154" hint="长度[6-32位]" bg="http://1.119.192.186:8088/img/a6.png" />
<input id="passnum" paddingLeft="5" inputType="number" maxLength = "3" marginTop="8" singleLine="true" marginLeft="16" h="*" w="154" hint="数量[选填]" bg="http://1.119.192.186:8088/img/a6.png" />
</linear>
</vertical>
<linear paddingTop='10'>
<checkbox id="str" text="小写字母" color="#684D38" marginLeft="16"/>
<checkbox id="STR" text="大写字母" color="#684D38" marginLeft="16"/>
</linear>
<linear paddingTop='10'>
<checkbox id="num" text="数字" color="#684D38" marginLeft="16"/>
<checkbox id="sym" text="特殊符号" color="#684D38" marginLeft="44"/>
</linear>
<input id="text_output" paddingLeft="5" gravity="top" bg="http://1.119.192.186:8088/img/TextBg1.png" color="#000000" size="15" margin="15 16 0 16" w="*" h="200" />
<linear gravity="center">
<button id="make" h="35" bg="http://1.119.192.186:8088/img/produce.jpg" margin="16"></button>
<button id="copy" h="35" bg="http://1.119.192.186:8088/img/copy.jpg" margin="16"></button>
</linear>
</vertical>
);22
ui.str.setChecked(true);
ui.STR.setChecked(true);
ui.num.setChecked(true);
ui.sym.setChecked(true);
ui.text_output.setCursorVisible(false);
ui.text_output.setFocusable(false);
ui.text_output.setHint(' 本程序是百度应用"随机密码生成器"的移植版,唯一不同的是,本程序可以一次性生成多条密码.');
var str = 'abcdefghijklmnopqrstuvwxyz';
var STR = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var num = '0123456789';
var sym = '[email protected]#~,.[]()!%^*$';
ui.make.click(function() {
var PassLength = ui.passlength.text();
var PassNum = ui.passnum.text();
if (PassLength == '') {
toast('密码长度不能为空!'); return;}
if (PassNum == '') {
PassNum = 1;}
if (PassLength < 6 || PassLength > 32) {
toast('长度设置非法!');
return;
}else if (PassNum == 0) {
toast('生成数量不可为"0"!');
return;
}
var text = new Array();
if (ui.str.isChecked()) {
text.push(str);}
if (ui.STR.isChecked()) {
text.push(STR);}
if (ui.num.isChecked()) {
text.push(num);}
if (ui.sym.isChecked()) {
text.push(sym);}
if (!ui.str.isChecked() && !ui.STR.isChecked() && !ui.num.isChecked() && !ui.sym.isChecked()) {
toast('请选择密码的组合元素');
return;
}
function randPassword(){
var pw = '';
for(i=0; i<PassLength; i++){
var strpos = random(0,text.length-1);
pw += text[strpos].charAt(random(0, text[strpos].length-1));
}
return pw;
}
var Result1 = '';
for (var j = 0; j < PassNum; j++) {
var Result = randPassword();
var Result1 = Result + '\n' + Result1;
}
// log(Result);
ui.text_output.setText(Result1);
});
ui.copy.click(function() {
var PasswordText = ui.text_output.text();
if (PasswordText != null && PasswordText != '') {
setClip(PasswordText);
var ClipText = getClip();
if (ClipText == PasswordText) {
toast('已复制到剪贴板!')
} else {
toast('写入剪贴板失败!')
}
} else {
toast('请先生成密码!');
}
return;
});
其他
作者:小空和小芝中的小空
转载说明-务必注明来源:https://zhima.blog.csdn.net/
这位道友请留步️,我观你气度不凡,谈吐间隐隐有王者霸气,日后定有一番大作为!!!旁边有点赞收藏今日传你,点了吧,未来你成功️,我分文不取,若不成功️,也好回来找我。
温馨提示:点击下方卡片获取更多意想不到的资源。
边栏推荐
- 【C】关于柔性数组.简要的谈谈柔性数组
- (Note) AXIS ACASIS DT-3608 Dual-bay Hard Disk Array Box RAID Setting
- PyQt5安装配置(PyCharm) 亲测可用
- What is the function of the import command of the page directive in JSP?
- day_05模块
- 编程与哲学(2)——输出是为了更好的输入
- Jenkins--基础--6.3--Pipeline--语法--脚本式
- TiFlash 存储层概览
- 【并发编程】- 线程池使用DiscardOldestPolicy策略、DiscardPolicy策略
- Qt读取文件中内容(通过判断GBK UTF-8格式进行读取显示)
猜你喜欢

openpyxl 单元格合并

leetcode:81. 搜索旋转排序数组 II

自定义卡包效果实现

Jenkins--基础--6.2--Pipeline--语法--声明式

不用Swagger,那我用啥?

小康股份更名赛力斯,如何走出一条高端产品的“丝绸之路”?
![shell中计算命令详解(expr、(())、 $[]、let、bc )](/img/3c/5cc4d16b9b525997761445f32802d5.png)
shell中计算命令详解(expr、(())、 $[]、let、bc )

Overview of Edge Computing Open Source Projects

Worship, Alibaba distributed system development and core principle analysis manual

LeetCode第三题(Longest Substring Without Repeating Characters)三部曲之一:解题思路
随机推荐
Pycharm (1) the basic use of tutorial
编程与哲学(2)——输出是为了更好的输入
堪称神级的阿里巴巴“高并发”教程《基础+实战+源码+面试+架构》
UVM事务级建模
spark:页面单跳转换率统计(案例)
EPSANet: An Efficient Pyramid Split Attention Block on Convolutional Neural Network
单机部署flink,创建oracle19c rac的连接表时报错 ORA-12505 ,怎么回事?
YugaByte adds Voyager migration service in its 2.15 database update
C语言基础_共用体
天地图给多边形加标注
What attributes and methods are available for page directives in JSP pages?
unity pdg 设置隐藏不需要的节点以及实现自动勾选自动加载项
spark:热门品类中每个品类活跃的SessionID统计TOP10(案例)
初学者怎么快速学会SQL
PyCharm使用教程(详细版 - 图文结合)
leetcode:639. 解码方法 II
LeetCode_2358_分组的最大数量
主流监控系统工具选型及落地场景参考
AI目标分割能力,无需绿幕即可实现快速视频抠图
Jenkins--基础--6.2--Pipeline--语法--声明式