Code : Tout sélectionner
Opt("GUIOnEventMode", 1)
$GUI = GUICreate("Surveillant de tâches IRIS", 360, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quitter")
$btntache = GUICtrlCreateButton("Tâches en cours",5, 40, 110, 30)
GUICtrlSetOnEvent($btntache, "Nbtache")
$btnentre = GUICtrlCreateButton("Entrées en cours",120, 40, 110, 30)
GUICtrlSetOnEvent($btnentre, "Totalentre")
$idLabel = GUICtrlCreateLabel("ERREUR : Inspection non lancée, vérifiez si aucun problème persiste", 20, 10, 200, 20)
GUISetState(@SW_SHOW, $GUI)
while 1
$entre = ""
$tache= 0
$doublon = 0
$Fichier = FileOpen($NomFichier, 0)
If $Fichier = -1 Then
MsgBox(0, "Erreur", "L'ouverture du fichier est impossible")
EndIf
while 1
$ligne = filereadline($fichier)
if @error = -1 then
exitloop
else
if stringinstr($ligne, $chainerecherchee, 2) <> 0 then
$doublon = $doublon + 1
endif
if stringinstr($ligne, $ChaineRechercheei,2) <> 0 Then
$tache = $tache + 1
endif
endif
wend
fileclose($nomfichier)
$inspec = dirgetsize("H:\", 1)
if $inspec = -1 then
msgbox(0, "erreur", "le répertoire recherché est obsolète", 5)
else
$entre &= " Documents en attente " & @CRLF
$entre &= "Taille totale = " & Round($inspec[0]/1024/1024, 2) & " Mb" & @CRLF
$entre &= "Dossiers = " & $inspec[2] & @CRLF
$entre &= "Total fichiers = " & $inspec[1] & @CRLF
endif
If $inspec[2] > 20 And $doublon > 1 Then
MsgBox(0, "Information", "Tâche(s) rapportée(s) détectée(s) et plus de 20 fichiers accumulés en entrée, envoi de la notification.", 5);
GUICtrlSetData($idLabel, "Tâche(s) rapportée(s) détéctée(s) et plus de 20 fichiers accumulés répertoire entrée")
_INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body1, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error)
EndIf
ElseIf $inspec[2] > 20 And $doublon < 2 Then
MsgBox(0, "Information", "Plus de 20 dossiers accumulés répertoire entrée, envoi de la notification.", 5);
GUICtrlSetData($idLabel, "Plus de 20 dossiers accumulés répertoire entrée")
_INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body2, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error)
EndIf
ElseIf $doublon > 1 And $inspec[2] < 20 Then
MsgBox(0, "Information", "Tâche(s) rapportée(s) détectés, envoi de la notification", 5);
GUICtrlSetData($idLabel, "Tache(s) rapportée(s) détéctés ")
_INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body3, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error)
EndIf
Else
GUICtrlSetData($idLabel, "VERIFICATION EN COURS...")
EndIf
sleep(60000)
WEnd
Func Nbtache()
MsgBox(0,"Tâches en cours", " La file d'attente est de "& $tache &" tâches")
EndFunc
Func Totalentre()
msgbox(64, "Total entrées", $entre )
$entre = "Patientez 60 secondes"
EndFunc
Func Quitter()
Exit
EndFunc