Hey, Leute.
Erstmal sorry, kann natürlich gerne mal das script posten. Is nur so, dass ich erst seit kurtzem Internet habe und eigentlich noch kein Plan davon hat was man in einem Forum tut und was man nicht tut, desshalb hab ich einfach mal ein gutes Stück meines Arbeit hochgeladen ohne bösen Hintergedanken

.
Hier mal das Script: (Ich zeig nur immer so ungern meine Scripts, weil die so schlecht geschrieben sind.)
"PC shutdown.pb"
Code: Alles auswählen
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
IncludeFile "main window script.pb"
Structure clock
s.d
m.d
h.d
EndStructure
Global countdown.clock
countdown\m=30
Global TimeElapsed.d
Global StartTime.d
Open_Window_0()
SetGadgetText(#Spin_0, "30")
Procedure SetCountdown(minutes)
countdown\s=0
countdown\m=minutes
countdown\h=0
EndProcedure
Procedure RefreshCountdown()
StartTime=ElapsedMilliseconds()
If countdown\s<0
countdown\m-1
countdown\s+60
ElseIf countdown\s>59
countdown\m+1
countdown\s-60
EndIf
If countdown\m<0
countdown\h-1
countdown\m+60
ElseIf countdown\m>59
countdown\h+1
countdown\m-60
EndIf
EndProcedure
Procedure CreateShutdownfile()
CreateFile(0,"ThisWillShutdownYourPC.bat") ; es wird eine batch-datei erstellt um den shutdown-befehl zu nutzen
WriteStringN(0,"shutdown -f -s -t 00")
WriteStringN(0,"del ThisWillShutdownYourPC.bat")
CloseFile(0)
EndProcedure
StartTime=ElapsedMilliseconds()
InitMouse()
Repeat
TimeElapsed=ElapsedMilliseconds()-StartTime
EventID=WindowEvent()
If EventID=#PB_Event_Gadget Or TimeElapsed>1000
Select EventID
Case #PB_Event_Gadget
If EventType()=1
SetGadgetText(#Spin_0, Str(Val(GetGadgetText(#Spin_0))+1))
ElseIf EventType()=-1
SetGadgetText(#Spin_0, Str(Val(GetGadgetText(#Spin_0))-1))
EndIf
EndSelect
If EventGadget()=#Button_0 And EventType()=#PB_EventType_LeftClick
SetCountdown(Val(GetGadgetText(#Spin_0)))
For i=1 To Round(Val(GetGadgetText(#Spin_0))/60,1)
RefreshCountdown()
Next
SetGadgetText(#Text_2,"countdown : "+Str(countdown\h)+":"+Str(countdown\m)+":"+Str(countdown\s))
EndIf
If TimeElapsed>1000
countdown\s-TimeElapsed/1000
RefreshCountdown()
If countdown\h<0
CreateShutdownfile()
RunProgram("ThisWillShutdownYourPC.bat")
End
EndIf
SetGadgetText(#Text_2,"countdown : "+Str(countdown\h)+":"+Str(countdown\m)+":"+Str(countdown\s))
SetWindowTitle(#Window_0,"PC shutdown "+Str(countdown\h)+":"+Str(countdown\m)+":"+Str(countdown\s))
EndIf
EndIf
Delay(10)
Until EventID = #PB_Event_CloseWindow
"main window script.pb"
Code: Alles auswählen
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)
;- Window Constants
;
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Spin_0
#Button_0
#Text_0
#Text_1
#Frame3D_0
#Text_2
#Text_3
EndEnumeration
Procedure Open_Window_0()
If OpenWindow(#Window_0, 246, 241, 281, 177, "PC shutdown", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_TitleBar )
If CreateGadgetList(WindowID(#Window_0))
SpinGadget(#Spin_0, 120, 60, 60, 20, 0, 120)
ButtonGadget(#Button_0, 80, 120, 130, 30, "start")
TextGadget(#Text_0, 40, 60, 70, 20, "shutdown in")
TextGadget(#Text_1, 190, 60, 60, 20, "minutes")
TextGadget(#Text_2, 100,100, 160, 20, "countdown : ")
Frame3DGadget(#Frame3D_0, 10, 20, 260, 150, "")
TextGadget(#Text_3, 100,10, 160, 15, "©® by Sebastian Lieb")
EndIf
EndIf
EndProcedure
Ähm... keine Ahnung warum das Einrücken Flöten gegangen ist?!
[edit] so code müsste jetzt auch eingerückt sein