(view source code of printpdf.kix as plain text)
; Some "shortcuts" to special characters
$n = Chr(13) + Chr(10)
$q = Chr(34)
; Check if argument is a valid file specification and build the file list
If $pdf = ""
GoTo Syntax
EndIf
If Exist( $pdf ) = 0
GoTo Syntax
EndIf
$filename = Dir( $pdf )
If @ERROR
GoTo Syntax
EndIf
While $filename <> "" and @ERROR = 0
$pdflist = $pdflist + " $q$filename$q "
$filename = Dir()
Loop
; Read the print command from the registry
$filetype = ReadValue( "HKEY_CLASSES_ROOT\.pdf", "" )
$printcmd = ReadValue( "HKEY_CLASSES_ROOT\$filetype\shell\print\command", "" )
; Quit if Acrobat Reader is not the default association for PDF files
If InStr( $printcmd, "{" )
GoTo Other
EndIf
; Execute the print command for all files from the list
$printcmd = SubStr( $printcmd, 1, InStr( $printcmd, "$q" + "%1$q" ) - 1 ) + $pdflist
Run $printcmd
; Normal program termination
Exit 0
:Other
? "This script only works when Acrobat Reader is the default association"
? "for PDF files.";
? "On this PC that doesn't seem to be the case, maybe because other"
? "Adobe software is installed as well.$n"
Exit 1
:Syntax
? "PrintPDF.kix, Version 1.00"
? "Print the specified PDF file(s)$n"
? "Usage: KIX32 PRINTPDF.KIX $PDF=$q" + "pdf_files$q$n"
? "Where: $q" + "pdf_files$q is (are) the PDF file(s) to be printed"
? " (use wildcards to specify more than one file)$n"
? "Note: This script will only work if Acrobat Reader is the default"
? " association for PDF files."
? " It usually fails on PCs with other Adobe software installed.$n"
? "Written by Rob van der Woude"
? "http://www.robvanderwoude.com$n"
Exit 1
page last modified: 2024-04-16; loaded in 0.0089 seconds