回复 22# FU586097
修改了一下,可以实现设置和修改密码 | #NoTrayIcon | | #Persistent | | SendMode Input | | SetWorkingDir, C:\Users\Public\Documents ;密码文件目录 | | If !FileExist(".password") { | | SetPassword() | | } | | SetTimer, BlockWindow, 500 | | Return | | | | BlockWindow: | | if WinExist("ahk_class CabinetWClass"){ | | WinClose | | Gui, Destroy | | WinClose | | If !FileExist(".password") { | | SetPassword() | | } | | Gui, Add, Text, w250 h30, 请输入密码 只验证一次: | | Gui, Add, Edit, Password w230 vPassword | | Gui, Add, Button, Default w100 h50 gCheckPassword, 确定 | | Gui, Add, Button, w100 h50 gButtonChangePassword, 修改密码 | | Gui, Show, w250 h200 | | Return | | } | | | | SetPassword() | | { | | InputBox, input_password, 设置密码, 请设置密码 | | FileDelete, .password | | FileAppend, %input_password%, .password | | FileSetAttrib, +H, .password | | } | | Return | | | | ChangePassword() | | { | | FileReadLine, stored_password, .password, 1 | | InputBox, current_password, 修改密码, 请输入当前密码 | | if (current_password = stored_password) { | | InputBox, new_password, 修改密码, 请输入新密码 | | FileDelete, .password | | FileAppend, %new_password%, .password | | FileSetAttrib, +H, .password | | MsgBox,, 密码修改成功 | | } else { | | MsgBox,, 当前密码错误 | | } | | } | | Return | | | | CheckPassword: | | Gui, Submit | | FileReadLine, stored_password, .password, 1 | | if (password = stored_password) { | | Run, explorer.exe ::{20D04FE0-3AEA-1069-A2D8-08002B30309D} | | ExitApp | | } else { | | MsgBox,, 密码错误 | | } | | Return | | | | ButtonChangePassword: | | ChangePassword() | | ReturnCOPY |
|