按键精灵_常用读取帐号密码函数封装

 

 

 

 

 

 

 

 

 

 

图片演示

 

Dim path="/sdcard/Pictures/zh.txt" //设帐号密码路径 文本格式: zhanghao|123456789
dim num=1 //读取记录行数
Function zh(path, num,txt)//读取帐号密码
    dim txt_date=File.Readline(path, num)
//    TracePrint UTF8.Len(txt_date)
    If UTF8.Len(txt_date) > 0 Then //判断读取是否错误或者已经读取完毕
//        TracePrint txt_date
        txt_date = Split(txt_date, "|")//分割符
        dim username = txt_date(0)
        dim password = txt_date(1)
        If txt = 1 Then 
            zh = username //如果TXT为1的时候就是账号
        Else 
            zh=password//如果TXT为1的时候就是密码
        End If    
    Else    
        zh=False //如果错误返回False
        TracePrint "帐号_Read_Fail"   
    End If
End Function

 

TracePrint zh(path, num,1) //测试输出帐号
TracePrint zh(path, num,2) //测试输出密码

 

赞 (0)