Alors sa fait quelques temps que je joue un peu avec autoit (logiciel que je trouve vraiment intéressant surtout pour tout ce qui est gestion réseau). Bref je débute, et surtout avec le GUI et là je ne comprend pas trop le problème ...
Le code si dessous et celui de mon script, il permettra de calculer la durée de connexion sur un des cyber de la boite et donc le tarif.
Il y'a juste la base (toute les fonctions sont pas implémenter et le code est pas encore nettoyer

Bref le problème : Il faut cliquer plusieurs fois sur le bouton start/stop pour qu'il prennent enfin l'action en compte ... Je pense que l'erreur est au niveau de la boucle while mais je comprend pas trop le problème :\
Voila, je vous remercie d'avance si vous avez une solution

Code : Tout sélectionner
#include <GUIConstants>
#include <date>
;variable
$hinput1 = 0
$hinput2 = 0
$hinput3 = 0
$hinput4 = 0
$binput1 = "Start"
$binput2 = "Start"
$binput3 = "Start"
$binput4 = "Start"
; == GUI generated with Koda ==
$Form1 = GUICreate("Calcul", 591, 238, 275, 125)
$Input1 = GUICtrlCreateInput($hinput1, 152, 40, 121, 21, -1,$WS_EX_CLIENTEDGE)
$Input2 = GUICtrlCreateInput($hinput2, 152, 72, 121, 21, -1,$WS_EX_CLIENTEDGE)
$Input3 = GUICtrlCreateInput($hinput3, 152, 104, 121, 21, -1,$WS_EX_CLIENTEDGE)
$Input4 = GUICtrlCreateInput($hinput4, 152, 136, 121, 21, -1,$WS_EX_CLIENTEDGE)
$Button1 = GUICtrlCreateButton($binput1, 416, 40, 59, 17)
$Button2 = GUICtrlCreateButton($binput2, 416, 72, 59, 17)
$Button3 = GUICtrlCreateButton($binput3, 416, 104, 59, 17)
$Button4 = GUICtrlCreateButton($binput4, 416, 136, 59, 17)
GUICtrlCreateLabel("Temps :", 176, 16, 42, 17)
$Input5 = GUICtrlCreateInput("0", 288, 40, 121, 21, -1, $WS_EX_CLIENTEDGE)
$Input6 = GUICtrlCreateInput("0", 288, 72, 121, 21, -1, $WS_EX_CLIENTEDGE)
$Input7 = GUICtrlCreateInput("0", 288, 104, 121, 21, -1, $WS_EX_CLIENTEDGE)
$Input8 = GUICtrlCreateInput("0", 288, 136, 121, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Nombres d'impréssions :", 288, 16, 117, 17)
GUICtrlCreateLabel("Cyber 1", 104, 40, 40, 17)
GUICtrlCreateLabel("Cyber 2", 104, 72, 40, 17)
GUICtrlCreateLabel("Cyber 3", 104, 104, 40, 17)
GUICtrlCreateLabel("Cyber 4", 104, 136, 40, 17)
$Group1 = GUICtrlCreateGroup("Tarifs", 0, 32, 97, 129)
GUICtrlCreateLabel("1/4h = 75c", 8, 48, 57, 17)
GUICtrlCreateLabel("20min = 1€", 8, 64, 56, 17)
GUICtrlCreateLabel("30min = 1.5€", 8, 80, 65, 17)
GUICtrlCreateLabel("1h = 3€", 8, 96, 40, 17)
GUICtrlCreateLabel("Impression = 20c", 8, 112, 84, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button5 = GUICtrlCreateButton("Calcul", 504, 40, 59, 17)
$Button7 = GUICtrlCreateButton("Calcul", 504, 72, 59, 17)
$Button8 = GUICtrlCreateButton("Calcul", 504, 104, 59, 17)
$Button6 = GUICtrlCreateButton("Calcul", 504, 136, 59, 17)
$Input9 = GUICtrlCreateInput("0", 504, 184, 65, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("A payer : ", 448, 184, 49, 17)
GUISetState(@SW_SHOW)
While 1
$msg = GuiGetMsg()
;------------------------------------------------------------START
if $Button1 = GuiGetMsg() & $binput1 = "start" then
$hinput1 = _DateTimeFormat( _NowCalc(),3)
GUICtrlSetData($Input1,$hinput1)
$binput1 = "Stop"
GUICtrlSetData($Button1,$binput1)
EndIf
if $Button2 = GuiGetMsg() & $binput2 = "start" then
$hinput2 = _DateTimeFormat( _NowCalc(),3)
GUICtrlSetData($Input2,$hinput2)
$binput2 = "Stop"
GUICtrlSetData($Button2,$binput2)
EndIf
if $Button3 = GuiGetMsg() & $binput3 = "start" then
$hinput3 = _DateTimeFormat( _NowCalc(),3)
GUICtrlSetData($Input3,$hinput3)
$binput3 = "Stop"
GUICtrlSetData($Button3,$binput3)
EndIf
if $Button4 = GuiGetMsg() & $binput4 = "start" then
$hinput4 = _DateTimeFormat( _NowCalc(),3)
GUICtrlSetData($Input4,$hinput4)
$binput4 = "Stop"
GUICtrlSetData($Button4,$binput4)
EndIf
;------------------------------------------------------------STOP
if $Button1 = GuiGetMsg() & $binput1 = "stop" then
$hinput1 = "0"
GUICtrlSetData($Input1,$hinput1)
$binput1 = "Start"
GUICtrlSetData($Button1,$binput1)
EndIf
if $Button2 = GuiGetMsg() & $binput2 = "stop" then
$hinput2 = "0"
GUICtrlSetData($Input2,$hinput2)
$binput2 = "Start"
GUICtrlSetData($Button2,$binput2)
EndIf
if $Button3 = GuiGetMsg() & $binput3 = "stop" then
$hinput3 = "0"
GUICtrlSetData($Input3,$hinput3)
$binput3 = "Start"
GUICtrlSetData($Button3,$binput3)
EndIf
if $Button4 = GuiGetMsg() & $binput4 = "stop" then
$hinput4 = "0"
GUICtrlSetData($Input4,$hinput4)
$binput4 = "Start"
GUICtrlSetData($Button4,$binput4)
EndIf
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case Else
;;;;;;;
EndSelect
WEnd
Exit