Donc je l'ai fait pour m'entrainer pas niveau Commande, mais pour les incrémentations et la fin tu Compte à Rebours.
Et je sais que certain ici mettrait 1 Min a le faire, mais j'ai pas leur niveau ^^
Cronomethre.au3
- (8.09 Kio) Téléchargé 343 fois
► Afficher le texte
Code : Tout sélectionner
;~ ***************************************************************************
;~ ***************************************************************************
;~ *** Chronomètre ***
;~ *** ***
;~ ***************************************************************************
;~ ***************************************************************************
;~ Script By : Q&D
;~ Version : 1.0
;~ Date : 26/08/2009
;~ #############################################
;~
;~ Description : Include pour CRT
;~
;~ #############################################
#include <GUIConstantsEx.au3>
;~ #############################################
;~
;~ Description : Variable initialisation
;~
;~ #############################################
Global $Minute_imput_read, $Seconde_imput_read, $fait, $H_imput_read
$fait = 0
;~ #############################################
;~
;~ Description : GUI
;~
;~ #############################################
$CRT = GUICreate("Chronomètre", 280, 230)
$H_imput = GUICtrlCreateInput("00", 30, 10, 50, 20)
GUICtrlCreateLabel("H", 85, 15)
$Minute_imput = GUICtrlCreateInput("00", 110, 10, 50, 20)
GUICtrlCreateLabel("Min", 165, 15)
$Seconde_imput = GUICtrlCreateInput("00", 190, 10, 50, 20)
GUICtrlCreateLabel("Sec", 245, 15)
$chekcro = GUICtrlCreateRadio("Chronomètre", 30, 40)
$chekcar = GUICtrlCreateRadio("Compte à Rebours", 150, 40)
$chekala = GUICtrlCreateRadio("Alarme", 30, 60)
$chekaff = GUICtrlCreateRadio("Afficher", 150, 60)
GUICtrlCreateGroup("", 30, 90, 220, 50)
$H_outpout = GUICtrlCreateLabel("", 110, 110)
$deux_point = GUICtrlCreateLabel(":", 130, 110)
$Minute_outpout = GUICtrlCreateLabel("", 140, 110)
$deux_2_point = GUICtrlCreateLabel(":", 160, 110)
$Seconde_outpout = GUICtrlCreateLabel("", 170, 110)
$boutton_go = GUICtrlCreateButton("Go", 90, 160, 100, 50)
GUICtrlSetCursor(-1, 0)
GUICtrlSetState($chekcro, $gui_checked)
GUISetState(@SW_SHOW)
;~ #############################################
;~
;~ Description : Main While
;~
;~ #############################################
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $boutton_go
$H_imput_read = GUICtrlRead($H_imput)
$Minute_imput_read = GUICtrlRead($Minute_imput)
$Seconde_imput_read = GUICtrlRead($Seconde_imput)
Go()
EndSelect
WEnd
;~ #############################################
;~
;~ Description : Main Fonction
;~
;~ #############################################
Func Go()
$chekcro_read = GUICtrlRead($chekcro)
$chekala_read = GUICtrlRead($chekala)
$chekaff_read = GUICtrlRead($chekaff)
$chekcar_read = GUICtrlRead($chekcar)
If $chekcro_read = $gui_checked Then
crono()
EndIf
If $chekala_read = $gui_checked Then
alarme()
EndIf
If $chekaff_read = $gui_checked Then
afficher()
EndIf
If $chekcar_read = $gui_checked Then
car()
EndIf
EndFunc ;==>Go
;~ #############################################
;~
;~ Description : Chronomètre
;~
;~ #############################################
Func crono()
GUICtrlSetData($boutton_go, "Stop")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $boutton_go
ExitLoop
EndSelect
$H_outpout = GUICtrlCreateLabel($H_imput_read, 110, 110)
$deux_point = GUICtrlCreateLabel(":", 130, 110)
$Minute_outpout = GUICtrlCreateLabel($Minute_imput_read, 140, 110)
$deux_2_point = GUICtrlCreateLabel(":", 160, 110)
$Seconde_outpout = GUICtrlCreateLabel($Seconde_imput_read, 170, 110)
Sleep(979)
$Seconde_imput_read = $Seconde_imput_read + 01
If $Minute_imput_read = 59 And $Seconde_imput_read = 59 Then
$H_imput_read = $H_imput_read + 01
EndIf
If $Seconde_imput_read = 59 Then
$Seconde_imput_read = 00
$Minute_imput_read = $Minute_imput_read + 01
If $Minute_imput_read = 60 Then
$Minute_imput_read = 00
EndIf
EndIf
WEnd
GUICtrlSetData($boutton_go, "Go")
EndFunc ;==>crono
;~ #############################################
;~
;~ Description : Compte à Rebours
;~
;~ #############################################
Func car()
GUICtrlSetData($boutton_go, "Stop")
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
Exit
Case $msg = $boutton_go
ExitLoop
EndSelect
$H_outpout = GUICtrlCreateLabel($H_imput_read, 110, 110)
$deux_point = GUICtrlCreateLabel(":", 130, 110)
$Minute_outpout = GUICtrlCreateLabel($Minute_imput_read, 140, 110)
$deux_2_point = GUICtrlCreateLabel(":", 160, 110)
$Seconde_outpout = GUICtrlCreateLabel($Seconde_imput_read, 170, 110)
Sleep(979)
$Seconde_imput_read = $Seconde_imput_read - 01
If $Minute_imput_read = 00 And $Seconde_imput_read = 00 Then
$H_imput_read = $H_imput_read - 01
If $H_imput_read = -1 Then
$H_imput_read = 00
$H_FINI = 1
EndIf
EndIf
If $Seconde_imput_read = 00 Then
$Seconde_imput_read = 59
$Minute_imput_read = $Minute_imput_read - 01
If $Minute_imput_read = -1 Then
$Minute_imput_read = 59
EndIf
EndIf
If ($Minute_imput_read = 59) And ($Seconde_imput_read = 59) And ($H_FINI = 1) Then
MsgBox(0, "Compte à Rebours", "Le Temps est FINI")
ExitLoop
EndIf
If ($Minute_imput_read = 00) And ($Seconde_imput_read = -1) And ($H_imput_read = 00) Then
MsgBox(0, "Compte à Rebours", "Le Temps est FINI")
ExitLoop
EndIf
WEnd
GUICtrlSetData($boutton_go, "Go")
$fait = 1
EndFunc ;==>car
;~ #############################################
;~
;~ Description : Afficher
;~
;~ #############################################
Func afficher()
MsgBox(0, "Afficher", $H_imput_read & " H " & $Minute_imput_read & " Min " & $Seconde_imput_read)
EndFunc ;==>afficher
;~ #############################################
;~
;~ Description : Alarme
;~
;~ #############################################
Func Alarme()
GUIDelete($CRT)
TrayTip("Alarme", "Mode Alarme Active", 20)
While 1
$H = @HOUR
$M = @MIN
$S = @SEC
If ($H = $H_imput_read) And ($M = $Minute_imput_read) And ($S = $Seconde_imput_read) Then
MsgBox(0, "ALARME", "Il est " & @HOUR & " H " & @MIN & @CRLF & "Vous Avez demander a être prévenue a cette Heure")
ExitLoop
EndIf
WEnd
Exit
EndFunc ;==>Alarme
;~ #################################################################################
;~ #################################################################################
;~ ##*****************************************************************************##
;~ ##* _________ _______ ____ ___ *##
;~ ##* | |------ | | | \ | | *##
;~ ##* | |___ | | | |\ \ | | *##
;~ ##* | |--- | | | | \ \ | | *##
;~ ##* | | | | | | \ \| | *##
;~ ##* |_| __|_|___ |_| \___| *##
;~ ##* *##
;~ ##*****************************************************************************##
;~ #################################################################################
;~ #################################################################################
Il reste un Bug pour arrêter le chrono, mais ça j'ai pas réussi a faire mieux

Le script fait pas joli a cause du forum

Mais il est aussi en pièce jointe