Jump to content
Sign in to follow this  
Wooltown

Run Your Scripts "secure" while not at the compute

Recommended Posts

:(

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.Au3

Opt("TrayIconHide", 1) ;0=show, 1=hide tray icon

While 1

BlockInput ( 1 )

sleep(150)

wend

LockIt.Au3

2 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.

/S

MainScript.au3

Func 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

Share this post


Link to post
Share on other sites

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...

Opt('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())

Share this post


Link to post
Share on other sites

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

Opt('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())

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...