j'ai parcouru le forum et lu la doc sur l impression :http://autoitscript.fr/forum/viewtopic. ... ion#p29103
mais je ne suis pas sûr que ça répond à mes attentes, car apparemment toutes les impressions se font à partir d'un fichier.
J'ai regardé sur le forum us et pour le moment pas de sujets traitant de cette idée.
Est il possible d'imprimer avec l'imprimante par défaut directement le contenu d'une editbox ?
J'ai choisi editbox mais je ne suis pas sûr que ce soit judicieux.
► Afficher le texteCode de travail
Code : Tout sélectionner
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global $PrintBox, $PrintZone, $Listing
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("Form1", 541, 289, 221, 158)
GUISetOnEvent($GUI_EVENT_CLOSE, "Sortie")
Global $ListOsType = GUICtrlCreateCombo("", 16, 32, 201, 25)
Global $ListOffice = GUICtrlCreateCombo("", 16, 72, 201, 25)
Global $ListAntivirus = GUICtrlCreateCombo("", 16, 112, 201, 25)
Global $Input1 = GUICtrlCreateInput("", 224, 32, 297, 21)
Global $Input2 = GUICtrlCreateInput("", 224, 72, 297, 21)
Global $Input3 = GUICtrlCreateInput("", 224, 112, 297, 21)
Global $Go = GUICtrlCreateButton("Go", 424, 240, 105, 33, $WS_GROUP)
GUICtrlSetOnEvent($Go, "Go_List")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Dim $OsType[18] = ["WindowsXP Home_32", "WindowsXP Home_64", "WindowsXP Pro_32", "WindowsXP Pro_64", _
"Vista Basique_32", "Vista_Basique_64", "Vista Prem_32", "Vista Prem_64", "Vista Pro_32", "Vista Pro64", "Vista Ultimate_32", "Vista Ultimate_64", _
"Win 7 Prem_32", "Win 7 Prem_64", "Win 7 Pro_32", "Win 7 Pro_64", "Win 7 Ultimate_32", "Win 7 Ultimate_64"]
; On construit le string
Global $string = ""
Global $string2 = ""
Global $string3 = ""
For $i In $OsType
$string &= $i & "|"
Next
$string = StringTrimRight($string, 1) ; c'est pour enlever le dernier |
;ConsoleWrite($string & @CRLF)
GUICtrlSetData($ListOsType, $string)
Dim $Office[8] = ["Office Famille et Etudiants 2007", "Office Business 2007", "Office Pro 2007", "Office Pro Plus 2007", _
"Office Famille et Etudiants 2010", "Office Famille et Entreprise 2010", "Office Professionnel 2010"]
For $i In $Office
$string2 &= $i & "|"
Next
$string2 = StringTrimRight($string2, 1) ; c'est pour enlever le dernier |
;ConsoleWrite($string2 & @CRLF)
GUICtrlSetData($ListOffice, $string2)
Dim $Antivirus[5] = ["Norton Internet Security 2012", "Norton Antivirus 360", "Kaspersky Internet Security 2012", "Kaspersky Antivirus 2012"]
For $i In $Antivirus
$string3 &= $i & "|"
Next
$string3 = StringTrimRight($string3, 1) ; c'est pour enlever le dernier |
;ConsoleWrite($string3 & @CRLF)
GUICtrlSetData($ListAntivirus, $string3)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Case $Go
Go_List()
Exit
EndSwitch
WEnd
Func Go_List()
Local $Os = GUICtrlRead($ListOsType) ; tout simplement
Local $OsNum = _RegExpLaddy(GUICtrlRead($Input1))
Local $Of = GUICtrlRead($ListOffice)
Local $OfNum = _RegExpLaddy(GUICtrlRead($Input2))
Local $Virus = GUICtrlRead($ListAntivirus)
Local $VirusNum = _RegExpLaddy(GUICtrlRead($Input3))
Local $Listing = $Os & ": " & $OsNum & @CRLF & _
$Of & ": " & $OfNum & @CRLF & _
$Virus & ": " & $VirusNum
Global $PrintBox = GUICreate("Form1", 625, 208, 192, 124)
Local $PrintZone = GUICtrlCreateEdit($Listing, 16, 24, 601, 137, $ES_READONLY)
Local $Print = GUICtrlCreateButton("Imprimer", 448, 176, 73, 25, $WS_GROUP)
GUICtrlSetOnEvent($Go, "Impr")
Local $Fermer = GUICtrlCreateButton("Fermer", 536, 176, 73, 25, $WS_GROUP)
GUICtrlSetOnEvent($Fermer, "Fonction_X2") ; *****
GUISetState(@SW_SHOW)
EndFunc ;==>Go_List
[color=#BF0000]Func Impr()
;imprimer le contenu de l edibox
EndFunc[/color]
Func _RegExpLaddy($string) ; Merci Topxm et Mikell
Return StringRegExpReplace($string, '(\w{5})(\w{5})(\w{5})(\w{5})(\w{5})', "$1-$2-$3-$4-$5")
EndFunc ;==>_RegExpLaddy
Func Fonction_X2() ; *****
GUIDelete($PrintBox) ; *****
EndFunc ;==>Fonction_X2
Func Sortie()
If @GUI_WinHandle = $Form1 Then
Exit
Else
GUIDelete(@GUI_WinHandle)
EndIf
EndFunc ;==>Sortie
Merci
Laddy





