#Persistent #SingleInstance Force ;====================================配置=========== IniRead, file, config.ini, lock, file, %A_ScriptDir%lock.jpg ;锁屏图片 IniRead, key, config.ini, lock, key, app ;密码 IniRead, hotkey, config.ini, lock, hotkey, ^`` ;快捷键 IniRead, idle, config.ini, lock, idle, 10 ;鼠键空闲多少分钟后自动锁定 IniRead, direct_lock, config.ini, lock, direct_lock, 0 ;运行软件时立即锁定 IniRead, if_turnoff_monitor, config.ini, lock, if_turnoff_monitor, 1 ;锁定时自动关闭屏幕 ;==================================================== Menu, tray, NoStandard Menu, tray, DeleteAll Menu, tray, Add, 锁定, start Menu, tray, Default, 锁定 Menu, tray, Add Menu, tray, Add, 退出 Hotkey, %hotkey%, start, On gosub CheckIdle if !direct_lock return start: i = 1 MouseGetPos, x, y MouseMove, A_ScreenWidth+10, A_ScreenHeight+10, 0 BlockInput, MouseMove key_list = Lbutton,Rbutton,Mbutton,LWin,Rwin,LAlt,RAlt,Ctrl,esc,del,f1,f4,tab Loop, parse, key_list, `, Hotkey, % A_LoopField, stop, on SetTimer,CheckIdle,off gosub TurnoffMonitor gosub stop Loop { Input, a, L1 i := (a = substr(key,i,1)) ? i+1 : 1 if (i=(strlen(key)+1)) { BlockInput, MouseMoveOff MouseMove, x, y, 0 Loop, parse, key_list, `, Hotkey, % A_LoopField, stop, off SetTimer, CheckIdle, On IfExist, %file% Gui, Destroy return } } return CheckIdle: SetTimer,CheckIdle,% idle ? idle*60000-A_TimeIdle : "off" if (idle and A_TimeIdle >= idle*60000) Gosub start return TurnoffMonitor: SetTimer, TurnoffMonitor, % (!if_turnoff_monitor or i=(strlen(key)+1)) ? "off" : A_TimeIdle>9000 ? 5000 : 5000-A_TimeIdle if (if_turnoff_monitor and i<>(strlen(key)+1) and A_TimeIdle > 5000 and A_TimeIdle < 9000) SendMessage, 0x112, 0xF170, 2,,ahk_id 0xFFFF return stop: settimer, stop, % i=(strlen(key)+1) ? "off" : 10000 if (FileExist(file) and !WinActive("abcde ahk_class AutoHotkeyGUI") and i<>(strlen(key)+1)) { Gui, Destroy Gui, +AlwaysOnTop +Disabled -SysMenu +Owner -Caption +ToolWindow Gui, margin, 0,0 Gui, Add, Picture, w%A_ScreenWidth% h%A_ScreenHeight%, %file% Gui, Show, Maximize,abcde MouseMove, A_ScreenWidth, A_ScreenHeight, 0 SEND CTRL } return 退出: ExitApp