je decouvre autoit, et je suis bloqué sur une commande...
Dans une GUI j'ai crée un combo avec une liste et un bouton "ENVOI" et je souhaiterais choisir un element dans mon combo et quand j appuie sur le bouton "ENVOI", le bon programme qui correspond a ce choix, se lance.
j'espere que c est clair.
Voila je sèche...
En resumé comment faire pour que quand je selectionne dans mon "combo" un choix dans ma liste et quand j appuie sur "envoi", le bon programme se lance...
Merci de votre aide.
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <DateTimeConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>
$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
$Form1_1 = GUICreate("essai", 445, 407, 295, 149)
$Tab1 = GUICtrlCreateTab(5, 64, 433, 276)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem(" Tableau de bord ")
$CALENDRIER = GUICtrlCreateDate("2009/02/11 21:23:5", 226, 300, 185, 21)
GUICtrlSetCursor (-1, 0)
$NOTEPAD = GUICtrlCreateButton("Notepad", 218, 147, 87, 34, 0)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetCursor (-1, 0)
$PING = GUICtrlCreateButton("Ping", 329, 147, 87, 34, 0)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetCursor (-1, 0)
$CALC = GUICtrlCreateButton("Calculatrice", 218, 195, 87, 34, 0)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetCursor (-1, 0)
$Button_1=GUICtrlCreateButton("Lancer",50,200,80);creation du bouton de lancement
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
$ENCADREMENT = GUICtrlCreateGroup("", 209, 131, 216, 155)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$TITRE = GUICtrlCreateLabel("EXERCICE", 41, 116, 119, 17)
$Combo1 = GUICtrlCreateCombo("", 9, 155, 196, 25)
GUICtrlSetData(-1, "exemple 1|EXEMPLE 2|EXEMPLE3|3XEMPLE4|EXEMPLE5|EXEMPLE6")
GUICtrlSetCursor (-1, 0)
$TabSheet2 = GUICtrlCreateTabItem("2 ")
$CPU = GUICtrlCreateButton("CPU", 314, 115, 87, 34, 0)
GUICtrlSetFont(-1, 9, 400, 0, "MS Sans Serif")
GUICtrlSetCursor (-1, 0)
GUICtrlCreateTabItem("")
$PAUSE = GUICtrlCreateButton("Pause", 122, 348, 87, 24, 0)
GUICtrlSetCursor (-1, 0)
$eteindre = GUICtrlCreateIcon("C:\WINDOWS\system32\shell32.dll", -216, 232, 343, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP))
GUICtrlSetTip(-1, "Quitter")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button_1
Case $Combo1
Case $CALENDRIER;Calendrier
Case $NOTEPAD
BLOCNOTE();Lance bloc-note
Case $PING
TESTPING()
Case $CALC
CALC();Calculatrice
Case $CPU
CPU()
Case $eteindre
QUIT();Eteindre
EndSwitch
WEnd
Func BLOCNOTE()
Opt("WinTitleMatchMode", 2)
$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Const $nomFenetre = "Sans titre - Bloc-notes"
If WinExists($nomFenetre) Then;Vérification si bloc-notes déjà ouvert
WinActivate($nomFenetre);attente de bloc-notes
WinWaitActive($nomFenetre, "",@SW_MAXIMIZE);Attente
Send("{CTRLDOWN}a{CTRLUP}{DEL}")
Send("{F5}") ;Insertion date et heure
Send(" Ecris ton texte.");inscription du text par défaut
return
Else
Run("notepad.exe");Ouverture bloc-notes
WinWaitActive($nomFenetre)
Send("{ENTER}")
Send("{CTRLDOWN}a{CTRLUP}{DEL}")
Send("{F5}") ;Insertion date et heure
Send(" Ecris ton texte.");inscription du text par défaut
return
EndIf
EndFunc ;==>BLOCNOTE
Func CALC()
Opt("WinTitleMatchMode", 2)
$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Const $nomFenetre3 = "Calculatrice"
If WinExists($nomFenetre3) Then ;Vérification si calculatrice déjà ouvert
WinActivate($nomFenetre3);attente de calculatrice
WinWaitActive($nomFenetre3, "",@SW_MAXIMIZE);Attente
Else
Run("calc.exe");Ouverture calculatrice
WinWaitActive($nomFenetre3);Attente
EndIf
EndFunc ;==>CALC
Func TESTPING()
Local $target, $a, $pong
$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work
Dim $a=0
$target= ("autoitscript.fr")
if $target="" then
Exit
endif
for $g=1 to 5
$pong = Ping ($target,250)
If @error = 0 Then
Msgbox(0,"Ping " & $g & " of 5","Response from " & $target & " in "& $pong & " ms",1)
elseif @error = 1 Then
Msgbox(0,"Ping " & $g & " of 5", $target & " is offline",1)
elseif @error = 2 Then
Msgbox(0,"Ping " & $g & " of 5", $target & " is unreachable",1)
elseif @error = 3 Then
Msgbox(0,"Ping " & $g & " of 5", $target & " is a bad destination",1)
Else
Msgbox(0,"Ping " & $g & " of 5", "Unknown error encountered",1)
EndIf
$a=$pong + $a
next
;MsgBox
If Not IsDeclared("iMsgBoxAnswer") Then Local $iMsgBoxAnswer
$iMsgBoxAnswer = MsgBox(65,"résultat","Moyenne roundtrip time : " & $a / 5 & " ms")
Select
Case $iMsgBoxAnswer = 1 ;OK
TESTPING()
Case $iMsgBoxAnswer = 2 ;Cancel
Return
EndSelect
EndFunc ;==>TESTPING
Func QUIT()
; Lancement du splash screen.
SplashTextOn("", "Fermeture du script en cours, Veuillez patienter ...", 450, 70, -1, -1, 0 + 1 + 16 + 32, "Times New Roman", 12, 800)
Sleep(3000); Pause de 3 secondes.
SplashOff(); Fermeture du splash.
Exit
EndFunc ;==>Fin
Func CPU()
#include <ProgressConstants.au3>
#include <GUIConstants.au3>
$memo22 =MemGetStats()
$memo233 =$memo22[1]
$form1_1 = GUICreate("CPU", 261, 156, 478, 449)
$Input1 = GUICtrlCreateInput("", 16, 24, 105, 21)
$Input2=GUICtrlCreateInput("", 16, 56, 105, 21)
$Input3=GUICtrlCreateInput("", 16, 88, 105, 21)
$Progress1 = GUICtrlCreateProgress(160, 8, 14, 105, BitOR($PBS_SMOOTH,$PBS_VERTICAL))
$Progress2 = GUICtrlCreateProgress(198, 9, 14, 105, BitOR($PBS_SMOOTH,$PBS_VERTICAL))
$Progress3 = GUICtrlCreateProgress(232, 8, 14, 105, BitOR($PBS_SMOOTH,$PBS_VERTICAL))
$Input4 = GUICtrlCreateInput("", 16, 120, 105, 21)
GUISetState(@SW_SHOW)
While 1
$memo =MemGetStats()
$memo2 =$memo[0]
$memo3 =$memo[2]
$var = $memo[4]
Switch $memo2
case 0 To 100
GUICtrlSetData ($Input1,$memo2&" %")
$st=StringRight ($memo3,2)
$st2=StringRight ($var,2)
GUICtrlSetData ($Input2,$memo3&" ko")
GUICtrlSetData ($Input3,$var&" ko")
GUICtrlSetData ($Progress1,$st)
GUICtrlSetData ($Progress2,$memo2)
GUICtrlSetData ($Progress3,$st2)
GUICtrlSetData ($Input4,@HOUR&":"&@MIN&":"&@SEC)
EndSwitch
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
EndFunc




