Wooltown Posted June 2, 2005 Share Posted June 2, 2005 Create a Script: LockIt.Au3 and compile it to LockIt.exe, this script will lock the computer every 150 millisecond, and makes it pratically impossible to brake, this is called from your main Script, make the sleep time shorter if you wish.LockIt.Au3Opt("TrayIconHide", 1) ;0=show, 1=hide tray iconWhile 1BlockInput ( 1 )sleep(150)wendLockIt.Au32 Functions from Main Script, before using a Send("xxxxx") do a InputUnlock and afterwords do a InputLock, this will increase security, for an unattended PC.When you make the Unlock, I set BlockInput to 1, so you will have to do a quick Ctrl+Alt+Delete and then break the script.Hopefully you can use it./SMainScript.au3Func InputLock() If ProcessExists ( "LockIt.exe" ) = 0 Then BlockInput(0) Run("LockIt.exe") $InputLock="YES" EndIf EndFunc ;====================================================Func InputUnLock() ProcessClose("LockIt.exe") ProcessWaitClose ("LockIt.exe") BlockInput(1) $InputLock="NO" EndFunc MainScript.au3 Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted June 2, 2005 Share Posted June 2, 2005 I have a similar script, where the monitor will be disabled until {F7} and {F9} are pressed within 1/2 second of each other. Just remove the While ProcessExists() loop, as that is for my ATI Multimedia Center app that usually runs at night... expandcollapse popupOpt('WinTitleMatchMode', 4) #region variables Const $WM_SYSCOMMAND = 274 Const $SC_MONITORPOWER = 61808 Const $POWERON = -1 Const $POWEROFF = 2 Dim $hwnd = WinGetHandle('classname=Progman') Global $x[2] #endregion #region functions Func key1() $x[0] = 1 EndFunc Func key2() $x[1] = 1 EndFunc Func keycheck() If $x[0] <> 0 AND $x[1] <> 0 Then AdLibDisable() Exit Else $x[0] = 0 $x[1] = 0 EndIf EndFunc ;==>keycheck #endregion HotKeySet("{F7}", "key1") HotKeySet("{F9}", "key2") $time = Int(StringReplace(InputBox("Time to Sleep", "What time should the computer go to sleep?", @HOUR & ":" & @MIN), ":", "")) Do Sleep(1000) Until $time = (@HOUR & @MIN) While ProcessExists("ATIMMC.exe") ControLSend("TV", "", "", "!{F4}") Sleep(500) WEnd AdLibEnable("keycheck", 500) While 1 DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWEROFF) Sleep(500) WEnd Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted June 20, 2005 Share Posted June 20, 2005 I forgot where the original thread was for disabling the monitor...this is the most recent related one however. I added a few lines of code to check whether the user wants to disable user input. Right now it won't re-enable user input until 0500 (5 am), however, I'll be working on that soon, I might just make a tiny gui instead of msg/input boxes...but that's not until later tonight or this week expandcollapse popupOpt('WinTitleMatchMode', 4) #region variables Const $WM_SYSCOMMAND = 274 Const $SC_MONITORPOWER = 61808 Const $POWERON = -1 Const $POWEROFF = 2 Dim $hwnd = WinGetHandle('classname=Progman') Global $x[2] #endregion #region functions Func key1() $x[0] = 1 EndFunc Func key2() $x[1] = 1 EndFunc Func keycheck() If $x[0] <> 0 AND $x[1] <> 0 Then AdLibDisable() Exit Else $x[0] = 0 $x[1] = 0 EndIf EndFunc ;==>keycheck #endregion HotKeySet("{F7}", "key1") HotKeySet("{F9}", "key2") $time = Int(StringReplace(InputBox("Time to Sleep", "What time should the computer go to sleep?", @HOUR & ":" & @MIN), ":", "")) $sleep = Not (MsgBox(260, "Time to Sleep", "Do you want to disable user input?") - 6) MsgBox(0, "test", $sleep) Do Sleep(1000) Until $time = (@HOUR & @MIN) While ProcessExists("ATIMMC.exe") ControLSend("TV", "", "", "!{F4}") Sleep(500) WEnd AdLibEnable("keycheck", 500) If $sleep = 1 Then $blkin = BlockInput(1) While 1 DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWEROFF) Sleep(500) If (@HOUR & @MIN) = 0500 AND $blkin = 1 Then BlockInput(0) $blkin = 0 EndIf WEnd Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now