also mein code ist ganz merkwurdig, ich wiess dass niemand ein solches skript braucht, aber so lerne ich neue funktionen (ich bin ziemlich neu in autoit)
hier ist mein ganzes code:
Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=E:\E Media\shutdown.ico
#AutoIt3Wrapper_Compression=4
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Global $MSGBOX, $action, $time, $time_progress, $nummer, $i, $timing
#include <wait.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=e:\d diverse\autoit\koda\saves\form1.kxf
$Form1_1 = GUICreate("Shutdown", 318, 160, 201, 129)
$Label1 = GUICtrlCreateLabel("Select the operation:", 8, 32, 102, 17)
$Combo1 = GUICtrlCreateCombo("Shutdown", 112, 32, 129, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Shutdown|Reboot|Force|Power down|Force if hung|Standby|Hibernate|Logoff")
$Button1 = GUICtrlCreateButton("GO!", 216, 64, 73, 33)
$Label2 = GUICtrlCreateLabel("Set time:", 8, 72, 45, 17)
$Input1 = GUICtrlCreateInput("", 64, 72, 65, 21)
$Label3 = GUICtrlCreateLabel("Minutes!", 136, 72, 44, 17)
$Progress1 = GUICtrlCreateProgress(8, 112, 209, 25, $PBS_SMOOTH)
GUICtrlSetColor(-1, 0x3399FF)
$Label4 = GUICtrlCreateLabel("Time", 232, 112, 64, 32)
GUICtrlSetFont(-1, 16, 400, 0, "News Gothic MT")
GUICtrlSetColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Main()
EndSwitch
WEnd
Func _Main()
$time = GUICtrlRead($Input1)
$time = $time * 60000
$time_progress = $time / 100
$action = GUICtrlRead($Combo1)
If $action == "Shutdown" Then
$action = 1
EndIf
If $action == "Reboot" Then
$action = 2
EndIf
If $action == "Power down" Then
$action = 8
EndIf
If $action == "Standby" Then
$action = 32
EndIf
If $action == "Hibernate" Then
$action = 64
EndIf
If $action == "Logoff" Then
$action = 0
EndIf
If $time = "" Then
MsgBox(16, "Error", "No value inserterd")
GUISetState(@SW_SHOW)
Else
;GUISetState(@SW_HIDE)
EndIf
$MSGBOX = MsgBox(1, GUICtrlRead($Combo1) , "Your computer will " & GUICtrlRead($Combo1) & " in " & GUICtrlRead($Input1) & " minutes")
If $MSGBOX = 1 Then
_Action()
Else
GUISetState(@SW_SHOW)
EndIf
EndFunc
#cs das habe ich versucht, funtioniert aber nicht
Func _Timing()
$timing = GUICtrlRead($Input1)
$timing = $timing - 1
GUICtrlSetData($Label4, $timing)
wait(60000)
EndFunc
#ce
Func _Action()
If $nMsg = $GUI_EVENT_CLOSE Then Exit
$nummer = 0
$sleep = $time ; wie lange es schlafen soll
GUICtrlSetLimit($Progress1,$sleep,0)
$i = 0
$Timer = TimerInit()
Do
wait($time_progress)
$nummer = $nummer + 1.09
GUICtrlSetData($Progress1,$nummer) ; GuiCtrlSetData(Gui object,wert / data)
$diff = TimerDiff($Timer)
Until $diff > $sleep
MsgBox(0, GUICtrlRead($Combo1), GUICtrlRead($Combo1)) ; nur zu uberprufen
;Shutdown($action)
Exit
EndFunc
mein skript schaltet das PC aus (oder restart, logoff und andere), in einer zeit. ich habe eine progressbare gemacht, und neben sie will ich die gebliebene zeit anzeigen, die sich von minute zur minute verkleinert.