Prints a plain text file
#include <File.au3>
_FilePrint ( $sFilePath [, $iShow = @SW_HIDE] )
$sFilePath | The file to print. |
$iShow | [optional] The state of the window. (default = @SW_HIDE) |
Success: | 1. |
Failure: | 0 and sets the @error flag to non-zero. |
Uses the ShellExecute function of shell32.dll.
#include <File.au3>
#include <MsgBoxConstants.au3>
Local $sFilePath = FileOpenDialog("Print File", "", "Text Documents (*.txt)", $FD_FILEMUSTEXIST)
If @error Then Exit
Local $iIsPrinted = _FilePrint($sFilePath)
If $iIsPrinted Then
MsgBox($MB_SYSTEMMODAL, "", "The file was printed.")
Else
MsgBox($MB_SYSTEMMODAL, "", "Error: " & @error & @CRLF & "The file was not printed.")
EndIf