Hallo zusammen,
ich hab da mal ein kleines Problem.
In diesem Script hat man die Auswahl zwischen Reboot, Shutdown und Abort.
Aber leider funktioniert es nicht so wie gewollt, schauts Euch am besten an.
Spoiler anzeigen
#NoTrayIcon
#include <GUIConstantsEx.au3>
Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("Boot-Auswahl", 250, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Wählen Sie den gewünschten Typ aus!", 20, 10)
[/autoit] [autoit][/autoit] [autoit]$okbutton = GUICtrlCreateButton("Reboot", 70, 50, 100)
GUICtrlSetOnEvent($okbutton, "_rebootclicked")
$okbutton = GUICtrlCreateButton("Shutdown", 70, 80, 100)
GUICtrlSetOnEvent($okbutton, "_shutdownclicked")
$okbutton = GUICtrlCreateButton("Abort", 70, 110, 100)
GUICtrlSetOnEvent($okbutton, "_abortclicked")
GUISwitch($mainwindow)
GUISetState(@SW_SHOW)
While 1
Sleep(1000)
WEnd
Global $aPC[2] = ["test1", "test2"]
[/autoit] [autoit][/autoit] [autoit]$timeout = "10"
$reboot = @SystemDir & "\shutdown.exe -r -f -t " & $timeout & " -m "
$shutdown = @SystemDir & "\shutdown.exe -s -f -t " & $timeout & " -m "
$abort = @SystemDir & "\shutdown.exe -a -m "
Func _rebootclicked()
For $i = 0 To 1
If $aPC[$i] <> "" Then _reboot($aPC[$i])
Next
EndFunc
Func _shutdownclicked()
For $i = 0 To 1
If $aPC[$i] <> "" Then _shutdown($aPC[$i])
Next
EndFunc
Func _abortclicked()
For $i = 0 To 1
If $aPC[$i] <> "" Then _abort($aPC[$i])
Next
EndFunc
Func _reboot($PC)
Run($reboot & $PC, "", @SW_HIDE)
EndFunc
Func _shutdown($PC)
Run($shutdown & $PC, "", @SW_HIDE)
EndFunc
Func _abort($PC)
Run($abort & $PC, "", @SW_HIDE)
EndFunc
Func CLOSEClicked()
If @GUI_WinHandle = $mainwindow Then
Exit
EndIf
EndFunc
Ich hoffe man sieht was ich erreichen möchte.
LG
Schnuecks