#NoTrayIcon ; bibliothèque pour les icones #include ; biblithèque constant #include ; bibliothèque pour les bouton #include #include ; bibliothèque constant windows #include #include #include HotKeySet("{ESC}", "_hkExitApp") ; exit app Opt("GUIOnEventMode", 1); utiliser en mode événement Global $sURL ; Global url 1 Global $sURL2 ; Global url 2 Global $sURL3 ; Global url 3 Global $sURL4 ; Global url 4 Global $sURL5 ; Global url 5 Global $sURL6 ; Global url 6 Global $sURL7 ; Global url 7 Global $sURL8 ; Global url 8 Global $sURL9 ; Global url 9 Global $sURL10 ; Global url 10 Global $sURL11 ; Global url 11 Global $sURL12 ; Global url 12 $Form1 = GUICreate("App: Diagnostic Sysème V1.0", 832, 629, -1, -1) ; formulaire global GUISetOnEvent($GUI_EVENT_CLOSE, "_hkExitApp"); définir un événement de sortie et utiliser un constant pour qu'il n'est pas beaucoup de chiffres magiques GUISetBkColor(0xABABAB) ;création des labels pour l'états des ping GUICtrlCreateLabel("hote 1 :", 20, 60, 90, 17) ; label host 1 GUICtrlCreateLabel("hote 2 :", 20, 85, 90, 17) ; label host 2 GUICtrlCreateLabel("hote 3 :", 20, 110, 90, 17) ; label host 3 GUICtrlCreateLabel("hote 4 :", 20, 135, 90, 17) ; label host 4 GUICtrlCreateLabel("hote 5 :", 20, 160, 90, 17) ; label host 5 GUICtrlCreateLabel("hote 6 :", 20, 185, 90, 17) ; label host 6 GUICtrlCreateLabel("hote 7 :", 20, 210, 90, 17) ; label host 7 ;création des labels pour l'état des services GUICtrlCreateLabel("hote 8 :", 428, 60, 90, 17) ; label host 8 GUICtrlCreateLabel("hote 9 :", 428, 85, 90, 17) ; label host 9 GUICtrlCreateLabel("hote 10 :", 428, 110, 90, 17) ; label host 10 GUICtrlCreateLabel("hote 11 :", 428, 135, 90, 17) ; label host 11 GUICtrlCreateLabel("hote 12 :", 428, 160, 90, 17) ; label host 12 ;création des zones de texte pour l'états des ping Global $Hostname1 = GUICtrlCreateInput("10.10.7.1", 120, 60, 209, 21) ; zone de texte hostname 1 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname2 = GUICtrlCreateInput("10.10.7.2", 120, 85, 209, 21) ; zone de texte hostname 2 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname3 = GUICtrlCreateInput("10.10.7.3", 120, 110, 209, 21) ; zone de texte hostname 3 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname4 = GUICtrlCreateInput("10.10.7.4", 120, 135, 209, 21) ; zone de texte hostname 4 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname5 = GUICtrlCreateInput("10.10.7.5", 120, 160, 209, 21) ; zone de texte hostname 5 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname6 = GUICtrlCreateInput("10.10.7.6", 120, 185, 209, 21) ; zone de texte hostname 6 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname7 = GUICtrlCreateInput("10.10.7.7", 120, 210, 209, 21) ; zone de texte hostname 7 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur ;création des zones de texte pour l'états de services Global $Hostname8 = GUICtrlCreateInput("10.10.7.8", 530, 60, 209, 21) ; zone de texte hostname 8 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname9 = GUICtrlCreateInput("10.10.7.9", 530, 85, 209, 21) ; zone de texte hostname 9 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname10 = GUICtrlCreateInput("10.10.7.10", 530, 110, 209, 21) ; zone de texte hostname 10 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname11 = GUICtrlCreateInput("10.10.7.11", 530, 135, 209, 21) ; zone de texte hostname 11 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur Global $Hostname12 = GUICtrlCreateInput("10.10.7.12", 530, 160, 209, 21) ; zone de texte hostname 12 GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0x00ff00) ; couleur ;création des icones pour l'état des ping Global $Status1 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 60, 16, 16) ; insertion de l'icone statut 1 Global $Status2 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 85, 16, 16) ; insertion de l'icone statut 2 Global $Status3 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 110, 16, 16) ; insertion de l'icone statut 3 Global $Status4 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 135, 16, 16) ; insertion de l'icone statut 4 Global $Status5 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 160, 16, 16) ; insertion de l'icone statut 5 Global $Status6 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 185, 16, 16) ; insertion de l'icone statut 6 Global $Status7 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 330, 210, 16, 16) ; insertion de l'icone statut 7 ;création des icones pour l'état des services Global $Status8 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 740, 60, 16, 16) ; insertion de l'icone statut 8 Global $Status9 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 740, 85, 16, 16) ; insertion de l'icone statut 9 Global $Status10 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 740, 110, 16, 16) ; insertion de l'icone statut 10 Global $Status11 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 740, 135, 16, 16) ; insertion de l'icone statut 11 Global $Status12 = GUICtrlCreateIcon(@ScriptDir & "\Yellow.ico", -1, 740, 160, 16, 16) ; insertion de l'icone statut 12 GUISetState(@SW_SHOW) ;création des menus $MenuFichier = GUICtrlCreateMenu("&Fichier") $MenuRedemarrer = GUICtrlCreateMenuItem("Redémarrer"&@TAB&"Ctrl+F4", $MenuFichier) $MenuTirer4 = GUICtrlCreateMenuItem("", $MenuFichier) $MenuQuitter = GUICtrlCreateMenuItem("Quitter"&@TAB&"Ctrl+Q", $MenuFichier) $MenuOutils = GUICtrlCreateMenu("&Outils") $MenuCmd = GUICtrlCreateMenuItem("CMD", $MenuOutils) $MenuTire1 = GUICtrlCreateMenuItem("", $MenuOutils) $MenuTelnet = GUICtrlCreateMenuItem("Client Telnet", $MenuOutils) $MenuTire2 = GUICtrlCreateMenuItem("", $MenuOutils) $MenuBlocnote = GUICtrlCreateMenuItem("Bloc note", $MenuOutils) $MenuTire3 = GUICtrlCreateMenuItem("", $MenuOutils) $MenuCalc = GUICtrlCreateMenuItem("Calculatrice", $MenuOutils) $MenuR = GUICtrlCreateMenu("&Réseaux") $MenuSt001 = GUICtrlCreateMenuItem("ST0-1", $MenuR) $MenuTire5 = GUICtrlCreateMenuItem("", $MenuR) $MenuSt002 = GUICtrlCreateMenuItem("ST0-2", $MenuR) $MenuTire6 = GUICtrlCreateMenuItem("", $MenuR) $MenuSt101 = GUICtrlCreateMenuItem("ST0-3", $MenuR) $MenuTire = GUICtrlCreateMenuItem("", $MenuR) $MenuSt102 = GUICtrlCreateMenuItem("ST1-3", $MenuR) $MenuTire7 = GUICtrlCreateMenuItem("", $MenuR) $MenuSt301 = GUICtrlCreateMenuItem("ST2-1", $MenuR) $MenuTire8 = GUICtrlCreateMenuItem("", $MenuR) $MenuSt302 = GUICtrlCreateMenuItem("ST2-2", $MenuR) $MenuItir9 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem4 = GUICtrlCreateMenuItem("ST2-3", $MenuR) $MenuItem3 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem2 = GUICtrlCreateMenuItem("ST2-4", $MenuR) $MenuItem7 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem6 = GUICtrlCreateMenuItem("DR", $MenuR) $MenuItem5 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem1 = GUICtrlCreateMenuItem("FRET", $MenuR) $MenuItem12 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem11 = GUICtrlCreateMenuItem("VIP-DEPART", $MenuR) $MenuItem9 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem10 = GUICtrlCreateMenuItem("VIP-ARRIVEE", $MenuR) $MenuItem8 = GUICtrlCreateMenuItem("", $MenuR) $MenuItem13 = GUICtrlCreateMenuItem("LTE", $MenuR) $StatusBar1 = _GUICtrlStatusBar_Create($Form1) Dim $StatusBar1_PartsWidth[2] = [50, -1] ; création de la barre de statut _GUICtrlStatusBar_SetParts($StatusBar1, $StatusBar1_PartsWidth) _GUICtrlStatusBar_SetText($StatusBar1, "V1.0", 0) _GUICtrlStatusBar_SetText($StatusBar1, "Diagnostic Système", 1) _GUICtrlStatusBar_SetMinHeight($StatusBar1, 35) $ToolBar1 = _GUICtrlToolbar_Create($Form1, 0) $Group1 = GUICtrlCreateGroup("Etat des Ping", 16, 40, 393, 369) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Etat des services", 424, 40, 393, 369) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Options", 16, 424, 249, 145) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $Button2 = GUICtrlCreateButton("Envoyer", 136, 456, 107, 41, BitOR($BS_DEFPUSHBUTTON,$WS_BORDER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button3 = GUICtrlCreateButton("Redémarrer", 24, 512, 107, 41, BitOR($BS_DEFPUSHBUTTON,$WS_BORDER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button4 = GUICtrlCreateButton("Quitter", 136, 512, 107, 41, BitOR($BS_DEFPUSHBUTTON,$WS_BORDER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlCreateGroup("", -99, -99, 1, 1) ;GUICtrlCreateGroup("", -99, -99, 1, 1) $Button1 = GUICtrlCreateButton("Rapport", 24, 456, 107, 41, BitOR($BS_DEFPUSHBUTTON,$WS_BORDER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Dim $Form1_AccelTable[2][2] = [["^{F4}", $MenuRedemarrer],["^q", $MenuQuitter]] GUISetAccelerators($Form1_AccelTable) ;$Button1 = GUICtrlCreateButton("Mirroring/principal", 8, 104, 147, 57, BitOR($BS_DEFPUSHBUTTON,$BS_CENTER,$WS_BORDER)) ;GUICtrlSetFont(-1, 10, 800, 0, "Verdana") ;$Button2 = GUICtrlCreateButton("Neurotechnology", 168, 104, 147, 57, BitOR($BS_DEFPUSHBUTTON,$BS_CENTER,$WS_BORDER)) ;GUICtrlSetFont(-1, 10, 800, 0, "Verdana") GUISetState(@SW_SHOW) AdlibRegister("CheckStats", 9000); vérifiez-les toutes les 10 secondes :) CheckStats() While Sleep(100) WEnd Func CheckStats() $sURL = GUICtrlRead($Hostname1) $sURL2 = GUICtrlRead($Hostname2) $sURL3 = GUICtrlRead($Hostname3) $sURL4 = GUICtrlRead($Hostname4) $sURL5 = GUICtrlRead($Hostname5) $sURL6 = GUICtrlRead($Hostname6) $sURL7 = GUICtrlRead($Hostname7) $sURL8 = GUICtrlRead($Hostname8) $sURL9 = GUICtrlRead($Hostname9) $sURL10 = GUICtrlRead($Hostname10) $sURL11 = GUICtrlRead($Hostname11) $sURL12 = GUICtrlRead($Hostname12) ;test de condition si ping reuissi ou pas oubien s'il y a des pertes de paquets If Ping($sURL, 999) > 0 Then GUICtrlSetImage($Status1, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname1, 0x00ff00) Else GUICtrlSetImage($Status1, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname1, 0xff0000) EndIf If Ping($sURL2, 999) > 0 Then GUICtrlSetImage($Status2, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname2, 0x00ff00) Else GUICtrlSetImage($Status2, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname2, 0xff0000) EndIf If Ping($sURL3, 999) > 0 Then GUICtrlSetImage($Status3, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname3, 0x00ff00) Else GUICtrlSetImage($Status3, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname3, 0xff0000) EndIf If Ping($sURL4, 999) > 0 Then GUICtrlSetImage($Status4, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname4, 0x00ff00) Else GUICtrlSetImage($Status4, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname4, 0xff0000) EndIf If Ping($sURL5, 999) > 0 Then GUICtrlSetImage($Status5, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname5, 0x00ff00) Else GUICtrlSetImage($Status5, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname5, 0xff0000) EndIf If Ping($sURL6, 999) > 0 Then GUICtrlSetImage($Status6, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname6, 0x00ff00) Else GUICtrlSetImage($Status6, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname6, 0xff0000) EndIf If Ping($sURL7, 999) > 0 Then GUICtrlSetImage($Status7, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname7, 0x00ff00) Else GUICtrlSetImage($Status7, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname7, 0xff0000) EndIf If Ping($sURL8, 999) > 0 Then GUICtrlSetImage($Status8, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname8, 0x00ff00) Else GUICtrlSetImage($Status8, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname8, 0xff0000) EndIf If Ping($sURL8, 999) > 0 Then GUICtrlSetImage($Status9, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname9, 0x00ff00) Else GUICtrlSetImage($Status9, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname9, 0xff0000) EndIf If Ping($sURL10, 999) > 0 Then GUICtrlSetImage($Status10, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname10, 0x00ff00) Else GUICtrlSetImage($Status10, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname10, 0xff0000) EndIf If Ping($sURL11, 999) > 0 Then GUICtrlSetImage($Status11, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname11, 0x00ff00) Else GUICtrlSetImage($Status11, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname11, 0xff0000) EndIf If Ping($sURL12, 999) > 0 Then GUICtrlSetImage($Status12, @ScriptDir & "\Green.ico") GUICtrlSetColor($Hostname12, 0x00ff00) Else GUICtrlSetImage($Status12, @ScriptDir & "\Red.ico") GUICtrlSetColor($Hostname12, 0xff0000) EndIf Return EndFunc Func _hkExitApp() Exit ;it is this part that poses me problem While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button4 Exit EndSwitch WEnd EndFunc ;==>_hkExitApp