sinelael Posted September 12, 2007 Posted September 12, 2007 Hello I am new at coding and at AutoIt so ... I have tried to make a little launcher for 3 scripts or programs. I would like to have this laucher open and launch when I want those utilities. The only input is two date useful for each script or program I have to launch. My problem : When I choose a radiobox and click on the button "Lancer" (launch) it works fine but only once ! I want to be able to select another radio and lauch again with the same dates or another dates. The second choice of the dates give unvalid value for $date_debut and $date_fin when I try to launch again with this line. RunWait("AutoIt3.exe bloquants.au3 " &$date_debut &" " &$date_fin, $repertoire_de_la_macro, @SW_MAXIMIZE) Note : I am working only for the moment on the "Case $msg = $Bouton_lancer" Some msgbox are here only to trace the variables Sorry for my english Thanks for help Sine CODE #include <GuiConstants.au3> #include <date.au3> Global $date_debut, $date_fin GuiCreate("Etats Statistiques", 509, 468,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label_1 = GuiCtrlCreateLabel("Début de période", 70, 60, 90, 20) $Label_2 = GuiCtrlCreateLabel("Fin de période", 330, 60, 90, 20) $date_debut = GuiCtrlCreateDate("", 30, 90, 180, 20,0x00) $date_fin = GuiCtrlCreateDate("", 250, 90, 220, 20,0x00) $Group_1 = GuiCtrlCreateGroup("Etats demandés", 80, 140, 210, 200) $Bouton_lancer = GuiCtrlCreateButton("Lancer", 80, 360, 120, 40) $Bouton_quitter = GuiCtrlCreateButton("Quitter", 330, 360, 120, 40) GUICtrlSetState($Bouton_lancer, $GUI_FOCUS + $GUI_DEFBUTTON) GUIStartGroup() $Radio_bloquants = GuiCtrlCreateRadio("Bloquants", 100, 160, 110, 60) $Radio_z10b = GuiCtrlCreateRadio("z10b", 100, 200, 110, 60) $Radio_ai4 = GuiCtrlCreateRadio("ai4", 100, 250, 110, 60) GuiSetState() Do $msg = GuiGetMsg() Select Case $msg = $Bouton_lancer While 1 Select Case BitAND(GUICtrlRead($Radio_bloquants), $GUI_CHECKED) = $GUI_CHECKED GUIGetMsg () $date_debut = GUICtrlRead($date_debut) $date_fin = GUICtrlRead($date_fin) $repertoire_de_la_macro ="D:\Myfiles\Mes Documents\Travail\Autoit\" MsgBox(0, "", "Lancement de l'état cas bloquants") MsgBox(0, "Date de debut", $date_debut) MsgBox(0, "Date de fin", $date_fin) RunWait("AutoIt3.exe bloquants.au3 " &$date_debut &" " &$date_fin, $repertoire_de_la_macro, @SW_MAXIMIZE) ExitLoop Case BitAND(GUICtrlRead($Radio_z10b), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0, "", "Lancement de l'état z10b") ExitLoop Case BitAND(GUICtrlRead($Radio_ai4), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0, "", "Lancement de l'état ai4") ExitLoop Case BitAND(GUICtrlRead($Radio_bloquants), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Radio_z10b), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Radio_ai4), $GUI_UNCHECKED) = $GUI_UNCHECKED MsgBox(0, "", "Merci de choisir un etat") ExitLoop EndSelect WEnd Case $msg = $Bouton_quitter MsgBox(0, "", "Bye") Exit EndSelect Until $msg = $GUI_EVENT_CLOSE Exit
stampy Posted September 12, 2007 Posted September 12, 2007 When reading the date control the variable for the date controls ID was being used instead of a variable for the read result. Try this... I also removed the second loop as it didn't seem to be needed. expandcollapse popup#include <GuiConstants.au3> #include <date.au3> Global $date_debut, $date_fin GUICreate("Etats Statistiques", 509, 468, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Label_1 = GUICtrlCreateLabel("Début de période", 70, 60, 90, 20) $Label_2 = GUICtrlCreateLabel("Fin de période", 330, 60, 90, 20) $date_debut = GUICtrlCreateDate("", 30, 90, 180, 20, 0x00) $date_fin = GUICtrlCreateDate("", 250, 90, 220, 20, 0x00) $Group_1 = GUICtrlCreateGroup("Etats demandés", 80, 140, 210, 200) $Bouton_lancer = GUICtrlCreateButton("Lancer", 80, 360, 120, 40) $Bouton_quitter = GUICtrlCreateButton("Quitter", 330, 360, 120, 40) GUICtrlSetState($Bouton_lancer, $GUI_FOCUS + $GUI_DEFBUTTON) GUIStartGroup() $Radio_bloquants = GUICtrlCreateRadio("Bloquants", 100, 160, 110, 60) $Radio_z10b = GUICtrlCreateRadio("z10b", 100, 200, 110, 60) $Radio_ai4 = GUICtrlCreateRadio("ai4", 100, 250, 110, 60) GUISetState() Do $msg = GUIGetMsg() Select Case $msg = $Bouton_lancer ;While 1 Select Case BitAND(GUICtrlRead($Radio_bloquants), $GUI_CHECKED) = $GUI_CHECKED GUIGetMsg() $date_debutREAD = GUICtrlRead($date_debut) $date_finREAD = GUICtrlRead($date_fin) $repertoire_de_la_macro = "D:\Myfiles\Mes Documents\Travail\Autoit\" MsgBox(0, "", "Lancement de l'état cas bloquants") MsgBox(0, "Date de debut", $date_debutREAD) MsgBox(0, "Date de fin", $date_finREAD) RunWait("AutoIt3.exe bloquants.au3 " & $date_debut & " " & $date_fin, $repertoire_de_la_macro, @SW_MAXIMIZE) ;ExitLoop Case BitAND(GUICtrlRead($Radio_z10b), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0, "", "Lancement de l'état z10b") ;ExitLoop Case BitAND(GUICtrlRead($Radio_ai4), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0, "", "Lancement de l'état ai4") ;ExitLoop Case BitAND(GUICtrlRead($Radio_bloquants), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Radio_z10b), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($Radio_ai4), $GUI_UNCHECKED) = $GUI_UNCHECKED MsgBox(0, "", "Merci de choisir un etat") ;ExitLoop EndSelect ;WEnd Case $msg = $Bouton_quitter MsgBox(0, "", "Bye") Exit EndSelect Until $msg = $GUI_EVENT_CLOSE Exit
sinelael Posted September 13, 2007 Author Posted September 13, 2007 When reading the date control the variable for the date controls ID was being used instead of a variable for the read result. Try this...I also removed the second loop as it didn't seem to be needed.Thanks for your help, it works !The second loop was useful because I want to keep open the window after a click on the "Lancer" button.Thanks so much
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now