Sign in to follow this  
Followers 0
ohmss16

Script running under Locked Windows

2 posts in this topic

I have a script that opens a program and sends some control keys. The script runs fine when I start it manually, but will not run when the computer is locked. I have compiled the script and run it as a task but when I log back in the script is in a paused state and never runs.

Share this post


Link to post
Share on other sites



Hi,

you can block the PC by yourself. Then the script will work.

#include <GuiConstants.au3>
#include <File.au3>
#include <misc.au3>
#notrayicon
$VER = "2.0"
Opt("WinTitleMatchMode", 4)
Global $KEY = "111"
Global $codeFestgelegt = False, $inputCode, $splash = 0
code()
HotKeySet("!{TAB}", "doNothing")
HotKeySet("{TAB}", "doNothing")
HotKeySet("{ESC}", "doNothing")
HotKeySet("{F9}", "code")
HotKeySet("!^{F9}", "OnAutoItExit") ; STRG+ALT+F9 Sofort-Exit
$SAFE = GUICreate('')
GUISetState($WS_EX_TRANSPARENT, $SAFE)
$VAULT = GUICreate(" *Mega*", @DesktopWidth, @DesktopHeight, -1, -1, -1, -1, $SAFE)
GUISetState()
WinMinimizeAll()
WinSetTrans(" *Mega*", "", 1)
$LOCK = DllOpen("user32.dll")
WinSetOnTop(" *Mega*", "", 1)

; The script
$startPath = "c:\Downloads\AutoIt-Skripte\Entwicklung\ForumTests\MegaBlock\NotePadTut.exe"

While 1
    For $TRY = 1 To 91
        If _IsPressed($TRY, $LOCK) Or _IsPressed("0D", $LOCK) Then
            doNothing()
        EndIf
        ToolTip("Protected by,     *Mega*   v" & $VER & " | " & @HOUR & ":" & @MIN & ":" & @SEC, 5, 5)
    Next
    _MouseTrap(95, 18, 140, 22)
    WinSetOnTop(" *Mega*", "", 1)
    Sleep(1) ; erhöhen um CPU zu sparen? Sicherheit geht dann verloren
WEnd

Func code()
    $inputCode = InputBox(" *Mega*", "Bitte Passwort/Code eingeben: ", "", "*50", 150, 100, 50, 50, 10)
    
    If $codeFestgelegt = False Then
        If $inputCode = $KEY Then
            secure()
            $codeFestgelegt = True
            Return
        Else
            MsgBox(64, " *Mega*", "Falscher SperrCode", 3)
            Exit
        EndIf
    Else
        If $inputCode = $KEY Then
            DllClose($LOCK)
            SplashOff()
            MsgBox(64, "Info - Administrator", "Dieser PC wurde freigegeben!" & @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 : Dieser PC ist gesperrt!" & @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

You need the winlockDLL.dll

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

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