AutoIt Forums _ Example Scripts _ Phony Windows Lock-Out

I use AutoIt a lot when I am at work, but I like to lock my computer using the (WinKey + L) when I am away from my desk. I needed a way to let my AutoIt apps and scripts run while I am away form my deak for maximum use of the automation, without appearing like the computer is “doing something magical” or looking like it is open to people stopping by to read my email…

Enter the Phony Windows Lock-Out. This is just a VERY basic GUI script that will make it look like the computer has been locked, while it’s not really locked at all, therefore allowing your apps to run and not be stopped by windows.

This was put together quickly, so there may be issues, but I know it’s something that I need so maybe you do too.

; ----------------------------------------------------------------------------
; AutoIt Version: 3.1.1 (beta)
; Language: English
; Platform: WinXP
; Author: Cybie
; Script Function:
; Fake the "computer locked" dialog so that AutoIt may run in the background.
; ----------------------------------------------------------------------------
#include <GuiConstants.au3>

$LockImage = @TempDir & "/" & "locked.jpg"
FileInstall("locked.jpg", $LockImage, 1)
$SecurityImage = @TempDir & "/" & "security.jpg"
FileInstall("security.gif", $SecurityImage, 1)

$username = "MKTNG\yourname (Your Name)"

; GUI looks like background.
GuiCreate("x", @DesktopWidth, @DesktopHeight, -1, -1, 0x80000000)
GUISetBkColor (0x6E8ADE)

GUICreate("Computer Locked", 400, 200, -1, -1, 0x00000000)
GUISetBkColor (0xE0E0C0)
GUICtrlCreatePic ($LockImage, 0, 0, 400, 75)
GUICtrlCreatePic ($SecurityImage, 10, 85, 32, 25)
GUICtrlCreateLabel("This computer is in use and has been locked.",52,85,325,20)
GUICtrlCreateLabel("Only " & $username & " or an administrator can unlock this computer.",52,105,325,40)
GUICtrlCreateLabel("Press Ctrl-Alt-Del to unlock this computer.",52,145,325,20)

$msg = 0
While $msg <> $GUI_EVENT_CLOSE
 $msg = GUIGetMsg()
;Keeps the computer from actually locking due to inactivity.
 $RandomMoveX = Random (1, @DesktopWidth)
 MouseMove ($RandomMoveX, @DesktopHeight)
 $RandomTime = Random (5000, 10000)
 WinActivate("Computer Locked")

Func KillSwitch()
 Exit 0
© 版权声明
点赞7 分享
评论 抢沙发