Hallo Community,
ich habe ein Skript geschrieben, um zu beobachten wann bestimmte Computer Online sind.
Hier erstmal das Skript:
Spoiler anzeigen
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
HotKeySet ("{END}", "stop")
[/autoit] [autoit][/autoit] [autoit]#Region ### START Koda GUI section ###
$Form1 = GUICreate("Wer ist Online?", 611, 340, 366, 327, BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
$Label1 = GUICtrlCreateLabel("Welcher PC ist Online?", 104, 32, 382, 41)
GUICtrlSetFont(-1, 24, 800, 2, "Lucida Fax")
$Label2 = GUICtrlCreateLabel("Benedikt", 192, 104, 105, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Label3 = GUICtrlCreateLabel("Franzsika", 192, 144, 114, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Label4 = GUICtrlCreateLabel("Max", 192, 184, 51, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Label5 = GUICtrlCreateLabel("Victoria", 192, 224, 99, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Label6 = GUICtrlCreateLabel("Mama", 192, 264, 68, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Franziska = GUICtrlCreateLabel("Online", 352, 144, 120, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Mama = GUICtrlCreateLabel("Online", 352, 264, 120, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Max = GUICtrlCreateLabel("Online", 352, 184, 120, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Victoria = GUICtrlCreateLabel("Online", 352, 224, 120, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
$Benedikt = GUICtrlCreateLabel("Online", 352, 104, 120, 31)
GUICtrlSetFont(-1, 16, 400, 0, "Showcard Gothic")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
GuiCtrlSetData ($Benedikt, "Offline")
GuiCtrlSetColor($Benedikt, 0xff0000)
GuiCtrlSetData ($Franziska, "Offline")
GuiCtrlSetColor ($Franziska, 0xff0000)
GuiCtrlSetData ($Max, "Offline")
GuiCtrlSetColor ($Max, 0xff0000)
GuiCtrlSetData ($Victoria, "Offline")
GuiCtrlSetColor ($Victoria, 0xff0000)
GuiCtrlSetData ($Mama, "Offline")
GuiCtrlSetColor ($Mama, 0xff0000)
While 1
If Not Ping("Maximilian") = 0 Then
GuiCtrlSetData ($Max, "Online")
GuiCtrlSetColor ($Max, 0x00ff00)
EndIf
If Not Ping("Franziska") = 0 Then
GuiCtrlSetData ($Franziska, "Online")
GuiCtrlSetColor ($Franziska, 0x00ff00)
EndIf
If Not Ping ("BENNE-PC") = 0 Then
GuiCtrlSetData ($Benedikt, "Online")
GuiCtrlSetColor ($Benedikt, 0x00ff00)
If Not Ping ("VICI-PC") = 0 Then
GuiCtrlSetData ($Victoria, "Online")
GuiCtrlSetColor ($Victoria, 0x00ff00)
EndIf
If Not Ping ("SYLVIA-PC") = 0 Then
GuiCtrlSetData ($Mama, "Online")
GuiCtrlSetColor ($Mama, 0x00ff00)
EndIf
Sleep (100)
WEnd
Func stop()
Exit
EndFunc
Wie ihr seht, wird dauerhaft überprüft, welcher Computer Online/Offline ist.
Nun wollte ich es so machen,
dass wenn ich auf einen Namen klicke also auf das Label, dann soll bei dem Computer alles minimiert werden und ne MsgBox kommen, so von wegen: "Es ist zu spät, mach bitte aus!"
Naja, per TCP send wird eben der Befehl gesendet und so weiter..
Das ist aber nicht mein Problem!
Sondern, muss ja die Schleife zur Überprüfung OB jemand Online ist laufen und dazu gleichzeitig die Schleife, mit der ich die Funktion auf dem Labelclick abrufe.
Also sowas:
While 1
;Switch etc
Case $Label1
;....
EndSwitch
WEnd
Gibt es dafür eine Lösung???
Edit: Spoiler gesetzt ![]()
Danke schonmal,