Jump to content
Sign in to follow this  
Guest martien

printing ps files using a dos-command

Recommended Posts

Guest martien

Here is a script that uses drag-n-drop to copy a PostScript (PS) file to a PS-printer.

Why this: sometimes it can take ages to print a pdf file to a laser printer. In such cases it may help to "print" the document to a file using a different printer.

So in my case the HP-Laser printer can spend ages to print a single page, and days to print off a big document.

To speed up, I print-to-file using an Apple PS Colour Printer. The resulting ps file has to be copied to the printer port (e.g. lpt1:), which requires some work if you do it the dos way.

The script enables you to drag the ps file into the drop-area, and ... you can choose from two printers.


; Script Name: Drop.Au3

; Description: FileDrop a PS file to a post-script printer

; Parameter(s): None

; Requirement(s): Not tested under 3.1.0 or earlier

; Return Value(s): None

; Author(s): Martien

; Date: 17 Mar 2005


#include <GuiConstants.au3>


;Note GUI Created with the Extended Windows Style ACCEPTFILES

GUICreate("Drag/Drop Demo", 330, 220, -1, -1, -1, $WS_EX_ACCEPTFILES)

GUICtrlCreateGroup ("Printer", 230, 40, 90, 140)

$radio_1 = GUICtrlCreateRadio ("HP C16", 240, 90, 70, 20)

$radio_2 = GUICtrlCreateRadio ("HP Clr", 240, 110, 70, 50)

GUICtrlCreateGroup ("",-99,-99,1,1)

GUICtrlSetState ($radio_1,$GUI_CHECKED)


;string for default status of InputBox

Global Const $txtInput = "Drag your print file here"

;Create handle for Input Box.

Global $hInput = GUICtrlCreateInput($txtInput, 10, 10, 200, 200);Specify that the control can respond to ACCEPTFILES messages



;Initialize Message Status

Local $msg = ""


While $msg <> $GUI_EVENT_CLOSE

$msg = GUIGetMsg()

;UDF to Monitor Controls that Accept Drag / Drop

;This is necessary becuase the drop operation does NOT send a message to the control,

;It simply dumps the CRLF separated list of files in the control, appending them to what went before.



Exit $msg

Func _MonitorFiles()

Local $text = GUICtrlRead($hInput)

If $text <> $txtInput Then;Something has changed

;strip the default text

$text = StringReplace($text, $txtInput, "")

;display what's left.

If StringRight($text,3)=".ps" Then


Case GUICtrlRead($radio_1)=1

;apply changes to the printer port-part (here network printer)

RunWait(@COMSPEC & ' /c copy ' & $text & ' \\central-print4\smc0164k /b')

MsgBox(0, "Job sent to HP printer!", $text, 0)

Case GUICtrlRead($radio_2)=1

;apply changes to the printer port-part:

RunWait(@COMSPEC & ' /c copy ' & $text & ' lpt1: /b')

MsgBox(0, "Job sent to HP Color printer!", $text, 0)



GUICtrlSetData($hInput, $txtInput)


EndFunc ;==> _MonitorFiles


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this