Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $PrintName, $IP, $Port, $Driver, $DriverSelect, $Save
$Form = GUICreate("Installation d'imprimante local", 298, 148, 193, 115)
$Label1 = GUICtrlCreateLabel("Nom pour l'imprimante :", 8, 16, 113, 17)
$Label2 = GUICtrlCreateLabel("Adresse IP:", 8, 48, 58, 17)
$Label3 = GUICtrlCreateLabel("Port :", 208, 48, 29, 17)
$Label4 = GUICtrlCreateLabel("Driver :", 8, 80, 38, 17)
$PrintName = GUICtrlCreateInput("", 120, 14, 162, 21)
$IP = GUICtrlCreateInput("192.168.", 72, 46, 121, 21)
$Port = GUICtrlCreateInput("", 240, 46, 42, 21)
$Driver = GUICtrlCreateInput("", 48, 78, 161, 21)
$DriverSelect = GUICtrlCreateButton("Selectionner", 216, 77, 75, 25, 0)
$Save = GUICtrlCreateButton("Enregistrement des paramètres imprimante", 8, 112, 283, 25, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $DriverSelect
$Open = FileOpenDialog("Selection du driver",@WindowsDir & "\", "Drivers (*.inf)")
If @error Then
MsgBox(4096,"","Aucun fichier choisis")
Else
GUICtrlSetData($Driver, $Open)
EndIf
Case $Save
$sIP = GUICtrlRead($IP)
$sPort = GUICtrlRead($Port)
$sPrintName = GUICtrlRead($PrintName)
$sDriver = GUICtrlRead($Driver)
ConsoleWrite("Nom : " & $sPrintName & @CRLF & "Port : " & $sPort & " IP: " & $sIP & @CRLF & "Driver : " & $sDriver)
EndSwitch
WEnd