Entschuldigung für den nichtssagenden Titel,
aber genau das ist das Problem -
ich habe keine Error, es sieht alles sauber aus,
aber manchmal geht garnichts mehr.
Folgendes Skript (selbstgemacht) soll mir helfen,
dass ich meinen PC unbeaufsichtigt Familienmitgliedern zur Verfügung stellen kann:
Spoiler anzeigen
#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
Global $forbidstring
[/autoit] [autoit][/autoit] [autoit]Do
$inpu = InputBox("","Passwort:","","*")
If @error Then Exit
$best = InputBox("","Nochmal das PW:","","*")
If @error Then Exit
If $inpu <> $best Then
MsgBox(16,"","Keine Übereinstimmung")
Else
ExitLoop
EndIf
Until 1=2
$var = WinList()
For $i = 1 to $var[0][0]
; Only display visble windows that have a title
If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
WinClose($var[$i][0])
EndIf
Next
$sProzess = "explorer.exe"
Run('"' & @ComSpec & '" /c taskkill /F /IM '&$sProzess, '', @SW_HIDE)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",1)
RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",1)
$gui = GUICreate("",300,450)
$list = GUICtrlCreateListView("Programm",5,5,290,340)
_GUICtrlListView_SetColumnWidth($list, 0, 290)
$startb = GUICtrlCreateButton("Starten",5,355,140,40)
$addb = GUICtrlCreateButton("Hinzufügen",155,355,140,40)
$endh = GUICtrlCreateInput(@HOUR+1,125,415,50,25)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,23,0)
$endm = GUICtrlCreateInput(@min,180,415,50,25)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1,60,0)
$settime = GUICtrlCreateButton("Set",180+55,415,50,25)
Local $limit = 0,$limith,$limitm
$showt = GUICtrlCreateLabel(@HOUR & ":" & @MIN,50,417,50,25)
GUISetState()
AdlibRegister("closef",1000)
OnAutoItExitRegister("endfu")
$timer = TimerInit()
while 1
If TimerDiff($timer) >= 1000*30 Then
GUICtrlSetData($showt,@HOUR & ":" & @MIN & "N")
$timer = TimerInit()
If $limit Then
GUICtrlSetData($showt,@HOUR & ":" & @MIN & " Y")
;HotKeySet("{f4}","notausgang")
If @HOUR >= $limith And @MIN >= $limitm Then
Do
;SoundPlay(@ScriptDir & "\sound.wav",0)
If InputBox("","Passwort?","","*",-1,-1,@DesktopWidth/2,@DesktopHeight/2,5) <> $inpu Then
MsgBox(16,"","Falsches PW",2)
Else
ExitLoop
EndIf
$var = WinList()
For $i = 1 to $var[0][0]
If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
WinClose($var[$i][0])
EndIf
Next
$check = StringSplit($forbidstring,"|")
[/autoit] [autoit][/autoit] [autoit]For $i = 1 To $check[0]
If ProcessExists($check[$i]) Then ProcessClose($check[$i])
Next
Beep(5000,2000)
Until 1=2
Exit
EndIf
EndIf
EndIf
Switch(GUIGetMsg())
Case $settime
If InputBox("","Passwort?","","*") <> $inpu Then
MsgBox(16,"","Falsches PW")
ContinueLoop
EndIf
$limit = Not $limit
If $limit Then
GUICtrlSetState($endh,$GUI_DISABLE)
GUICtrlSetState($endm,$GUI_DISABLE)
GUICtrlSetData($settime,"Stop")
GUISetState()
$limith = GUICtrlRead($endh)
$limitm = GUICtrlRead($endm)
Else
GUICtrlSetState($endh,$GUI_ENABLE)
GUICtrlSetState($endm,$GUI_ENABLE)
GUICtrlSetData($settime,"Set")
GUISetState()
EndIf
Case $GUI_EVENT_CLOSE
If InputBox("","Passwort?","","*") <> $inpu Then
MsgBox(16,"","Falsches PW")
ContinueLoop
EndIf
Exit
Case $addb
If InputBox("","Passwort?","","*") <> $inpu Then
MsgBox(16,"","Falsches PW")
ContinueLoop
EndIf
$fop = FileOpenDialog("","","Exe (*.exe)")
If @error Then ContinueLoop
GUICtrlCreateListViewItem($fop,$list)
$spl = StringSplit($fop,"\")
$forbidstring = $forbidstring & "|" & $spl[$spl[0]] & "|"
Case $startb
$read = StringReplace(GUICtrlRead(GUICtrlRead($list)),"|","")
If StringLen($read) < 2 Then
MsgBox(16,"","Wähle ein Programm aus")
ContinueLoop
EndIf
ShellExecute($read)
EndSwitch
WEnd
Func closef()
$var = WinList()
For $i = 1 to $var[0][0]
If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
$acb = WinGetProcess($var[$i][0])
$name = ""
$list = ProcessList()
for $i = 1 to $list[0][0]
If $list[$i][1] = $acb Then
$name = $list[$i][0]
ExitLoop
EndIf
next
If Not StringInStr($forbidstring,$name) Then
;WinClose($var[$i][0])
ProcessClose($name)
EndIf
EndIf
Next
EndFunc
Func endfu()
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",0)
RegWrite("HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System","DisableTaskMgr","REG_DWORD",0)
ShellExecute("explorer.exe")
EndFunc
Func notausgang()
Exit
EndFunc
Func IsVisible($handle)
If BitAnd( WinGetState($handle), 2 ) Then
Return 1
Else
Return 0
EndIf
EndFunc
Folgende Obskuritäten treten allerdings MANCHMAL (habe keinen Trigger gefunden) auf:
Zitat
* Wenn ich ein Programm hinzufüge, und den FileOpenDialog bestätige, passiert garnichts
==> Neustart behebt oft das Problem
* Die Zeitmessung, um die Benutzung des Computers zu beenden, funktioniert oft/immer nicht,
wenn noch ein anderes, intern gestartetes Programm im Vordergrund läuft
Ich hoffe hier einfach mal auf Verbesserungsvorschläge
und auf den entscheidenden Hinweis auf diese Gelegenheitsfehler...