UDF > File >


_FilePrint

Imprime un fichier texte

#include <File.au3>
_FilePrint ( $sFilePath [, $iShow = @SW_HIDE] )

Paramètres

$sFilePath Le fichier à imprimer.
$iShow [optionnel] L'état de la fenêtre d'impression. (par défaut = @SW_HIDE)

Valeur de retour

Succès: Retourne 1.
Échec: Retourne 0 et définit @error <> 0.

Remarque

Utilise la fonction ShellExecute de shell32.dll.

Exemple

#include <File.au3>
#include <MsgBoxConstants.au3>

Local $sFilePath = FileOpenDialog("Print File", "", "Text Documents (*.txt)", $FD_FILEMUSTEXIST)
If @error <> 0 Then Exit

Local $iIsPrinted = _FilePrint($sFilePath)
If $iIsPrinted = 1 Then
    MsgBox($MB_SYSTEMMODAL, "", "Le fichier a été imprimé.")
Else
    MsgBox($MB_SYSTEMMODAL, "", "Erreur: " & @error & @CRLF & "Le fichier n'a pas été imprimé.")
EndIf