Sign in to follow this  
Followers 0
cheeseslice

need a bit of a push in the right direction, blockinput

5 posts in this topic

Hi,

I have been messing about with autoit now for the past few weeks and i'm a bit hooked, everytime i go to do something in work i end up writing a script for it so I don't ever have to do it again!

Anyway, I need a bit of advice as far as blockinput goes. Twice a year there is a demonstration in my work where about 100 pc's run different powerpoints to show off work to visitors, this is a bit of a pain for a number of reasons. Each computer needs to be logged in using a username and password that I have created for these events that has restricted access to everything, the screensaver needs to be disabled from coming on so that it will not affect the powerpoint that is looping, the xplock needs to be prevented from coming on and i want to block the keyboard and mouse so that no-one can mess with the powerpoints.

I decided to write each function one by one so that I could get each bit working before trying to put it all together.

The easiest way I thought of doing this is to have a text document with each machine name on a seperate line, loop through this document using each name with vnc to log into the machine and run a random powerpoint, from a selection being held in a shared network drive.

Would vnc be the best option or could I use something else? An how do I block user input on xp sp2? I have tried just using blockinput(1) but that doesn't seem to work.

Once I get this done I can move on to preventing the xp lock and screensaver, I read in another post that someone sent a keypress to Num Lock every five mintues but I suppose if I use blockinput that idea isn't going to work.

any advice would be appreicated.

Share this post


Link to post
Share on other sites



Hi,

you can try something like this:

#include <GuiConstants.au3>
#include <File.au3>
#include <misc.au3>
#notrayicon
$version = "2.0"
Opt("WinTitleMatchMode", 4)
Global $blockingKey = "111"
Global $codeGiven = False, $inputCode, $splash = 0

code()

HotKeySet("!{TAB}", "doNothing")
HotKeySet("{TAB}", "doNothing")
HotKeySet("{ESC}", "doNothing")
HotKeySet("{F9}", "code")
HotKeySet("!^{F9}", "OnAutoItExit") ; STRG+ALT+F9 Secret-Exit

$safeGUI = GUICreate('')
GUISetState($WS_EX_TRANSPARENT, $safeGUI)
$blockGUI = GUICreate(" *Mega*", @DesktopWidth, @DesktopHeight, -1, -1, -1, -1, $safeGUI)
GUISetState()

WinMinimizeAll()
WinSetTrans(" *Mega*", "", 1)
$dll = DllOpen("user32.dll")
WinSetOnTop(" *Mega*", "", 1)

; The scriptyou want to run
$startPath = "c:\Downloads\AutoIt-Skripte\Entwicklung\ForumTests\MegaBlock\NotePadTut.exe"

While 1
    For $i = 1 To 91
        If _IsPressed($i, $dll) Or _IsPressed("0D", $dll) Then
            doNothing()
        EndIf
        ToolTip("Protected by,     *Mega*   v" & $version & " | " & @HOUR & ":" & @MIN & ":" & @SEC, 5, 5)
    Next
    _MouseTrap(95, 18, 140, 22)
    WinSetOnTop(" *Mega*", "", 1)
    Sleep(1) ; save CPU
WEnd

Func code()
    $inputCode = InputBox(" *Mega*", "The code please: ", "", "*10", 150, 120, 50, 50, 10)
    
    If $codeGiven = False Then
        If $inputCode = $blockingKey Then
            secure()
            $codeGiven = True
            Return
        Else
            MsgBox(64, " *Mega*", "Wrong code for blocking!", 3)
            Exit
        EndIf
    Else
        If $inputCode = $blockingKey Then
            DllClose($dll)
            SplashOff()
            MsgBox(64, "Info - Administrator", "This PC has been unlocked!" & @LF & @LF & _
                    "Tel.: XXXX" & @LF & _
                    "Email: Mega@xxx.com" & @LF & _
                    @LF & _
                    "Mega", 3)
            _MouseTrap()
            Sleep(2000)
            Exit
        Else
            WinSetOnTop(" *Mega*", "", 1)
            Return
        EndIf
    EndIf
EndFunc   ;==>code


Func secure()
    WinMinimizeAll()
    ;Hide Taskbar
    DllCall("WinLockDll.dll", "Int", "Taskbar_Show_Hide", "Int", "0")
    ;Disable CrtlAltDel
    $splash = SplashTextOn("", "Administrator : This PC is locked!" & @LF & @LF & _
            "Tel.: XXXX" & @LF & @LF & _
            "Email: Mega@xxx.com" & @LF & _
            @LF & @LF & _
            "Mega", _
            550, @DesktopHeight / 2, 1, 500, 1, 5, 16, 600)
    DllCall("WinLockDll.dll", "Int", "CtrlAltDel_Enable_Disable", "Int", "0")
    ;DllCall("WinLockDll.dll", "Int", "Desktop_Show_Hide", "Int", "0")
EndFunc   ;==>secure

;DllCall("WinLockDll.dll", "Int", "Process_Desktop", "str", "MyDesktop2", "str", "cmd.exe")

Func OnAutoItExit()
    WinMinimizeAllUndo()
    _MouseTrap()
    ;DllCall("WinLockDll.dll", "Int", "Desktop_Show_Hide", "Int", "1")
    DllCall("WinLockDll.dll", "Int", "CtrlAltDel_Enable_Disable", "Int", "1")
    DllCall("WinLockDll.dll", "Int", "Taskbar_Show_Hide", "Int", "1")
    SplashOff()
    Exit (0)
EndFunc   ;==>OnAutoItExit

Func doNothing()
    _MouseTrap(95, 18, 140, 22)
    WinSetState("Windows Task-Manager", "", @SW_HIDE)
    WinSetOnTop(" *Mega*", "", 1)
EndFunc   ;==>doNothing

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

How about removing all the i/o devices? Such as keyboard and mouse.

hahah, I never thought of that but it wouldn't be practical, these computers are spread over a number of sites. It would just be too time consuming.

Share this post


Link to post
Share on other sites

hahah, I never thought of that but it wouldn't be practical, these computers are spread over a number of sites. It would just be too time consuming.

Ok, I always cary an extra mouse anyway. :whistle:

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  
Followers 0