MACSCRPT Archives

March 2010

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
John Delacour <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Wed, 3 Mar 2010 17:31:32 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (34 lines)
At 23:51 +0000 2/3/10, I wrote:

>...The print files are spooled to /var/spool/cups/, which requires 
>root access.
>
>Then convert the resulting PostScript file to pdf using ps2pdf...


I see that is not necessary.  Once you have printed the file

print window 1 with properties {target printer:"my virtual printer"}

you will have a pdf (not a ps file) already at 
/var/spool/cups/d00012-001, for example.

What the script below does is copy that file to your temp folder, 
renaming it "my.pdf", and open the file in Preview.

set _user to "nmnmnmnm"
set _pass to "******"
set _mactemp to (path to temporary items from user domain) as Unicode text
set _pdf to POSIX path of _mactemp & "my.pdf"
do shell script "cd /var/spool/cups/; f=`ls -t -name d*001`; cp $f 
\"" & _pdf & "\"; open -a preview \"" & _pdf & "\"" user name _user 
password _pass with administrator privileges


This is just a (working and tested) example. In practice you would 
need to isolate the file you needed if there were more than 1 spooled 
file.


JD

ATOM RSS1 RSS2