Anregungen gern gesehen
Immoment noch sehr simple. Denke es gibt da auch schon ne ganze Menge von, aber da ich keine Lust hatte zu suchen
Spoiler anzeigen
#cs
KillProcessLater v1b
by -ROUGE-
https://autoit.de/index.php?page…81252#post81252
#ce
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
#include <DateTimeConstants.au3>
#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]Global $guititle = "KillProcessLater", $do_restart = 0, $do_shutdown = 0
[/autoit] [autoit][/autoit] [autoit]$maingui = GUICreate($guititle, 265, 160, 270, 225, $WS_SYSMENU)
$time = GUICtrlCreateDate("", 170, 32, 75, 20, $DTS_TIMEFORMAT)
$lable = GUICtrlCreateLabel("Kill process after spezific time", 16, 11, 400, 17)
$combo = GUICtrlCreateCombo("Please choose!", 16, 32, 145, 25)
$exit = GUICtrlCreateButton("Exit", 15, 90, 50, 25, 0)
$killstart = GUICtrlCreateButton("Set Killer", 72, 90, 70, 25, 0)
$shutdown = GUICtrlCreateCheckbox("Shutdown", 16, 60, 65, 17)
$restart = GUICtrlCreateCheckbox("Restart", 87, 60, 57, 17)
$alltitles = ProcessList()
[/autoit] [autoit][/autoit] [autoit]For $i = 1 to $alltitles[0][0]
GUICtrlSetData($combo, $alltitles[$i][0])
Next
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
exit
Case $exit
exit
Case $killstart
$process = GUICtrlRead($combo)
$timetokill = StringSplit(GUICtrlRead($time), ":")
GUICtrlSetState($killstart, $GUI_DISABLE)
GUICtrlSetState($time, $GUI_DISABLE)
GUICtrlSetState($combo, $GUI_DISABLE)
GUICtrlSetState($restart, $GUI_DISABLE)
GUICtrlSetState($shutdown, $GUI_DISABLE)
_GUICtrlButton_SetText($killstart, "Enabled")
_GUICtrlButton_SetText($exit, "Stop")
While 1
$nMsg = GUIGetMsg()
If @HOUR = $timetokill[1] and @MIN = $timetokill[2] and @SEC = $timetokill[3] Then
If $do_restart = 1 Then Shutdown(2)
If $do_shutdown = 1 Then Shutdown(1)
ProcessClose($process)
Exitloop
ElseIf $nMsg = $exit Then
exitloop
ElseIf $nMsg = $GUI_EVENT_CLOSE Then
exit
EndIF
WEnd
GUICtrlSetState($killstart, $GUI_ENABLE)
GUICtrlSetState($time, $GUI_ENABLE)
GUICtrlSetState($combo, $GUI_ENABLE)
GUICtrlSetState($restart, $GUI_ENABLE)
GUICtrlSetState($shutdown, $GUI_ENABLE)
_GUICtrlButton_SetText($killstart, "Set Killer")
_GUICtrlButton_SetText($exit, "Exit")
Case $restart
If $do_restart = 0 Then
$do_restart = 1
GUICtrlSetState($shutdown, $GUI_UNCHECKED)
GUICtrlSetState($shutdown, $GUI_DISABLE)
Else
$do_restart = 0
GUICtrlSetState($shutdown, $GUI_ENABLE)
EndIf
Case $shutdown
If $do_shutdown = 0 Then
$do_shutdown = 1
GUICtrlSetState($restart, $GUI_UNCHECKED)
GUICtrlSetState($restart, $GUI_DISABLE)
Else
$do_shutdown = 0
GUICtrlSetState($restart, $GUI_ENABLE)
EndIf
EndSwitch
WEnd
v1b - 14.03.2009 - 18:16 Uhr
- Shutdown / Restart Checkboxen hinzugefügt