Je débute avec AutoIT et n'ai pas beaucoup de notions en programmation.
Je tente d'écrire un programme permettant d'avoir une fenêtre avec des boutons qui réalisent une action lorsqu'on clique dessus. (Ca pourrais vous paraitre enfantin, mais moi j'ai beaucoup de mal). J'ai des difficultés à trouver des exemples que je comprend (vu mon niveau c'est compliqué).
Voici ce que j'ai fait pour le moment, mais ça ne fonctionne pas, il ne se passe rien lorsque je clique sur le bouton, et je ne comprend pas ce que j'ai fait de mal. Pourriez-vous m'aider s'il vous plait ?
; AutoIt 3.0.103 example
; 17 Jan 2005 - CyberSlug
; This script shows manual positioning of all controls;
; there are much better methods of positioning...
#include <GuiConstants.au3>
$OSArch = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "PROCESSOR_ARCHITECTURE")
; GUI
$hGUI = GuiCreate("SysPrep W10", 400, 400)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
; BUTTON
$Firefox = GuiCtrlCreateButton("Firefox", 10, 45, 100, 30)
$7zip = GuiCtrlCreateButton("7-Zip", 10, 75, 100, 30)
$Infra = GuiCtrlCreateButton("InfraRecorder", 10, 105, 100, 30)
$Java = GuiCtrlCreateButton("Java", 110, 45, 100, 30)
$Loffice = GuiCtrlCreateButton("Libre Office", 110, 75, 100, 30)
$Ostarter = GuiCtrlCreateButton("Office Starter", 110, 105, 100, 30)
$Adober = GuiCtrlCreateButton("Acrobat Reader", 210, 45, 100, 30)
$vlc = GuiCtrlCreateButton("VLC", 210, 75, 100, 30)
$Opatch = GuiCtrlCreateButton("Patch Office", 210, 105, 100, 30)
$Fram35 = GuiCtrlCreateButton(".NET 3.5", 10, 170, 100, 30)
$Qlaunch = GuiCtrlCreateButton("Quick Launch", 10, 200, 100, 30)
$Dicons = GuiCtrlCreateButton("Desktop Icons", 10, 230, 100, 30)
$DLext = GuiCtrlCreateButton("DL Extensions", 110, 170, 100, 30)
$label1 = GuiCtrlCreateLabel("Préparation du système pour les machines Windows 10", 75, 5)
$label2 = GuiCtrlCreateLabel("Système " & $OSArch, 150, 22)
$label2color = GuiCtrlSetColor(-1,0xFF0000)
GUISetState(@SW_SHOW, $hGUI)
$iPID = 0
$idMsg = GUIGetMsg()
;While ($idMsg <> $GUI_EVENT_CLOSE) And ($idMsg <> $idClose)
; If $idMsg = $Firefox Then
; ; Exécute le Bloc-notes avec la fenêtre agrandie au maximum.
; $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED)
; EndIf
$idMsg = GUIGetMsg()
; WEnd
While GuiGetMsg() <> $GUI_EVENT_CLOSE
If $idMsg = $Firefox Then
$iPID = MsgBox(1, "test", "test")
EndIf
WEnd
GUIDelete($hGUI)
;; GUI MESSAGE LOOP
;GuiSetState()
; 17 Jan 2005 - CyberSlug
; This script shows manual positioning of all controls;
; there are much better methods of positioning...
#include <GuiConstants.au3>
$OSArch = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Environment", "PROCESSOR_ARCHITECTURE")
; GUI
$hGUI = GuiCreate("SysPrep W10", 400, 400)
GuiSetIcon(@SystemDir & "\mspaint.exe", 0)
; BUTTON
$Firefox = GuiCtrlCreateButton("Firefox", 10, 45, 100, 30)
$7zip = GuiCtrlCreateButton("7-Zip", 10, 75, 100, 30)
$Infra = GuiCtrlCreateButton("InfraRecorder", 10, 105, 100, 30)
$Java = GuiCtrlCreateButton("Java", 110, 45, 100, 30)
$Loffice = GuiCtrlCreateButton("Libre Office", 110, 75, 100, 30)
$Ostarter = GuiCtrlCreateButton("Office Starter", 110, 105, 100, 30)
$Adober = GuiCtrlCreateButton("Acrobat Reader", 210, 45, 100, 30)
$vlc = GuiCtrlCreateButton("VLC", 210, 75, 100, 30)
$Opatch = GuiCtrlCreateButton("Patch Office", 210, 105, 100, 30)
$Fram35 = GuiCtrlCreateButton(".NET 3.5", 10, 170, 100, 30)
$Qlaunch = GuiCtrlCreateButton("Quick Launch", 10, 200, 100, 30)
$Dicons = GuiCtrlCreateButton("Desktop Icons", 10, 230, 100, 30)
$DLext = GuiCtrlCreateButton("DL Extensions", 110, 170, 100, 30)
$label1 = GuiCtrlCreateLabel("Préparation du système pour les machines Windows 10", 75, 5)
$label2 = GuiCtrlCreateLabel("Système " & $OSArch, 150, 22)
$label2color = GuiCtrlSetColor(-1,0xFF0000)
GUISetState(@SW_SHOW, $hGUI)
$iPID = 0
$idMsg = GUIGetMsg()
;While ($idMsg <> $GUI_EVENT_CLOSE) And ($idMsg <> $idClose)
; If $idMsg = $Firefox Then
; ; Exécute le Bloc-notes avec la fenêtre agrandie au maximum.
; $iPID = Run("notepad.exe", "", @SW_SHOWMAXIMIZED)
; EndIf
$idMsg = GUIGetMsg()
; WEnd
While GuiGetMsg() <> $GUI_EVENT_CLOSE
If $idMsg = $Firefox Then
$iPID = MsgBox(1, "test", "test")
EndIf
WEnd
GUIDelete($hGUI)
;; GUI MESSAGE LOOP
;GuiSetState()