J'ai créer un programme, nous choisissons les programmes à installer, le programme les télécharge et les installe.
Pendant chaque installation le programme a un "ProcessExist" pour savoir si l'installation est terminée pour les .exe ça marche mais quand il installe les .msi le processus ne se ferme jamais !
Le code (attention un peu long 197 lignes) :
► Afficher le texte
Code : Tout sélectionner
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("AutoInstaller", 599, 271, 206, 136)
Global $Group1 = GUICtrlCreateGroup("Programmes", 8, 8, 209, 249)
Global $Group2 = GUICtrlCreateGroup("Java", 16, 40, 193, 57)
Global $Radio1 = GUICtrlCreateRadio("32x", 32, 72, 57, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Checkbox3 = GUICtrlCreateCheckbox("Google Chrome", 16, 104, 193, 25)
Global $Checkbox4 = GUICtrlCreateCheckbox("Mozilla Firefox", 16, 128, 193, 25)
Global $Checkbox5 = GUICtrlCreateCheckbox("XNA Framework", 16, 152, 193, 25)
Global $Checkbox6 = GUICtrlCreateCheckbox("NET Framework 4", 16, 176, 193, 25)
Global $Checkbox7 = GUICtrlCreateCheckbox("VLC", 16, 200, 193, 25)
Global $Checkbox8 = GUICtrlCreateCheckbox("LibreOffice", 16, 224, 193, 25)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Radio2 = GUICtrlCreateRadio("64x", 144, 72, 113, 17)
Global $Button1 = GUICtrlCreateButton("Sortir", 224, 24, 89, 49)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
Global $Button2 = GUICtrlCreateButton("Go", 224, 200, 89, 49)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
Global $Group3 = GUICtrlCreateGroup("Téléchargement", 320, 8, 265, 249)
GUICtrlSetFont(-1, 10, 400, 0, "Comic Sans MS")
Global $Progress1 = GUICtrlCreateProgress(336, 104, 233, 25, BitOR($PBS_SMOOTH,$WS_BORDER))
Global $Label1 = GUICtrlCreateLabel("En cours:", 328, 48, 83, 28)
Global $Label2 = GUICtrlCreateLabel("...", 416, 48, 160, 28)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Global $lien_java32 = "http://gfmodd1.webselffiles01.com/download/jre-7u25-windows-i586_ws1013496168.exe"
Global $lien_java64 = "http://javadl.sun.com/webapps/download/AutoDL?BundleId=78827"
Global $lien_chrome = "https://dl.google.com/tag/s/appguid%3D%7B8A69D345-D564-463C-AFF1-A69D9E530F96%7D%26iid%3D%7B92E14AFF-3671-A1A8-5601-9B19CE89887A%7D%26lang%3Dfr%26browser%3D4%26usagestats%3D0%26appname%3DGoogle%2520Chrome%26needsadmin%3Dtrue%26installdataindex%3Ddefaultbrowser/update2/installers/ChromeSetup.exe"
Global $lien_firefox = "https://download.mozilla.org/?product=firefox-21.0&os=win&lang=fr"
Global $lien_xna = "http://download.microsoft.com/download/A/C/2/AC2C903B-E6E8-42C2-9FD7-BEBAC362A930/xnafx40_redist.msi"
Global $lien_net = "http://download.microsoft.com/download/1/B/E/1BE39E79-7E39-46A3-96FF-047F95396215/dotNetFx40_Full_setup.exe"
Global $lien_vlc = "http://ftp.free.org/mirrors/videolan/vlc/2.0.7/win32/vlc-2.0.7-win32.exe"
Global $lien_libreoffice = "http://download.documentfoundation.org/libreoffice/stable/4.0.4/win/x86/LibreOffice_4.0.4_Win_x86.msi"
Global $ins = 0
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1
Exit
Case $Button2
go()
EndSwitch
WEnd
Func go()
if GUICtrlRead($Radio1) = 1 Then
Local $stat = InetGet($lien_java32, @TempDir & "\jre32x.exe", 1, 1)
GUICtrlSetData($Label2, "Java 32 bits")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
Run(@TempDir & "\jre32x.exe")
While ProcessExists("jre32x.exe") = True
Sleep(250)
WEnd
EndIf
if GUICtrlRead($Radio2) = 1 Then
Local $stat = InetGet($lien_java64, @TempDir & "\jre64x.exe", 1, 1)
GUICtrlSetData($Label2, "Java 64 bits")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
Run(@TempDir & "\jre64x.exe")
While ProcessExists("jre64x.exe") = True
Sleep(250)
WEnd
EndIf
if GUICtrlRead($Checkbox3) = 1 Then
Local $stat = InetGet($lien_chrome, @TempDir & "\chrome.exe", 1, 1)
GUICtrlSetData($Label2, "Google Chrome")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
Run(@TempDir & "\chrome.exe")
While ProcessExists("chrome.exe") = True
Sleep(250)
WEnd
EndIf
if GUICtrlRead($Checkbox4) = 1 Then
Local $stat = InetGet($lien_firefox, @TempDir & "\firefox.exe", 1, 1)
GUICtrlSetData($Label2, "Mozilla Firefox")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
Run(@TempDir & "\firefox.exe")
While ProcessExists("firefox.exe") = True
Sleep(250)
WEnd
EndIf
if GUICtrlRead($Checkbox5) = 1 Then
Local $stat = InetGet($lien_xna, @TempDir & "\xna_framework.msi", 1, 1)
GUICtrlSetData($Label2, "XNA Framework")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
ShellExecute(@TempDir & "\xna_framework.msi")
While ProcessExists("msiexec.exe") = True
Sleep(100)
WEnd
EndIf
if GUICtrlRead($Checkbox6) = 1 Then
Local $stat = InetGet($lien_xna, @TempDir & "\net_framework.exe", 1, 1)
GUICtrlSetData($Label2, "NET Framework")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
Run(@TempDir & "\net_framework.exe")
While ProcessExists("net_framework.exe") = True
Sleep(250)
WEnd
EndIf
if GUICtrlRead($Checkbox7) = 1 Then
Local $stat = InetGet($lien_vlc, @TempDir & "\vlc.exe", 1, 1)
GUICtrlSetData($Label2, "VLC")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
Run(@TempDir & "\vlc.exe")
While ProcessExists("vlc.exe") = True
Sleep(250)
WEnd
EndIf
if GUICtrlRead($Checkbox8) = 1 Then
Local $stat = InetGet($lien_libreoffice, @TempDir & "\libreoffice.msi", 1, 1)
GUICtrlSetData($Label2, "Libre Office")
Do
Local $taille_telecharger = InetGetInfo($stat)
GUICtrlSetData($Progress1, $taille_telecharger[0] / $taille_telecharger[1] * 100)
Until InetGetInfo($stat, 2)
GUICtrlSetData($Progress1, 0)
GUICtrlSetData($Label2, "")
InetClose($stat)
Sleep(200)
$ins = 1
ShellExecute(@TempDir & "\libreoffice.msi")
While ProcessExists("libreoffice.msi") = True
Sleep(250)
WEnd
EndIf
if $ins = 1 Then
MsgBox(0, "Finis", "Installation terminée !")
EndIf
$ins = 0
EndFunc

