How to script dragging a PostScript file onto a desktop printer
How to script dragging a PostScript file onto a desktop printer
- Subject: How to script dragging a PostScript file onto a desktop printer
- From: "David B. Gustavson" <email@hidden>
- Date: Thu, 2 Aug 2001 19:39:43 -0700
Thanks, Steve Goodman--your suggestion does work. It wasn't working
for me until now, because the printer is more particular about the
format of the PostScript file when the file is handed to it this way
than when I manually drag it onto the printer icon!
My PS file that caused all my troubles started with:
%!PSAdobe-1.0
which works fine with manually dragging the file and with other
downloaders like DropPS, but causes the file to be ejected from the
printer when handled by the following script!
When I changed the first line (imitating the PS generated by Print to File) to
%!PS-Adobe
suddenly it started working!! It doesn't care about %%EOF or anything
else inside the file as far as I can tell. Maybe it just checks the
first 10 characters.
The printer also doesn't seem to care about the file's creator, as
long as its type is TEXT (I didn't actually test any other types).
Setting the default printer isn't necessary, since the correct
printer is specifically named in the script.
So, here's all that's needed to script printing a PostScript file:
set Print_file to "HD:foo:bar.ps" -- path to your file
set Printer_loc to "HD:Desktop Folder:printer name:" -- path to your printer
tell application "Finder" to copy file Print_file to alias Printer_loc
The PostScript file has to begin with "%!PS-Adobe" and should have type "TEXT".
Dave