RE: Brother's AS Postscript from Quark
RE: Brother's AS Postscript from Quark
- Subject: RE: Brother's AS Postscript from Quark
- From: email@hidden
- Date: Sat, 13 Jul 2002 10:21:36 EDT
Perhaps if you understand clearly what is happening, it will help you
accomplish what you want:
on print_document_ps() --
-- Set Virtual Postscript Printer
tell application "Desktop Printer Manager"
-- points the print manager at a virtual printer (i.e. a PS file)
set default printer to desktop printer the "Virtual Printer"
end tell
--Print Postscript File
tell application "QuarkXPress 4.1"
-- tell QXPress to become the front-most application
activate
-- run the page-setup command, with the following settings,
-- remembering that we pointed the desktop print monitor at
-- saving the file to the desktop as a postscript file
set print setup of document 1 to {printer type:"Barco Graphics
TransScript OF", resolution:1200, data format:binary data, halftone
screen:"150"}
-- print the file, saving it to the desktop
print document 1 PostScript file (my saveFolder & my
clientDocTitle & ".ps" as text)
end tell
-- Copy PS to (Hot folder) on Server
-- Note, this next line calls a handler that isn't shown in your
-- email, called fileFormat. Since it isn't shown, I can only guess
-- at what it is doing (picking a file by type)
if my fileFormat = "EPS" then
-- go grab the finder, which handles file copying/moving/deleting
tell application "Finder"
-- bring the finder to the front
activate
-- if the file exists (and this is dependent on which version of
-- applescript you are using, because you are coercing a string
-- into representing a file based on location, something that
-- generates a bug under as v1.7x
if exists (file (my clientDocTitle & ".ps" as string) of
folder (my saveFolder as string)) then
-- copy the file (requires Jon's Commands), replacing
-- any file there by the same name (provided it's not
-- locked) to the destination drive/location named
-- input_ps (but no test to validate that input_ps exists
copyFile (my saveFolder & my clientDocTitle & ".ps" as
text) to (alias "input_ps:") with replacing
else
-- otherwise, if the file doesn't exist, wait 5 seconds.
-- you might want to up the delay factor or put this into
-- a loop where it keeps waiting until the file shows up.
delay 5 -- catch slow PS processing again
-- try to copy the file again (note, if the renderer
hasn't
-- completed the printing to the eps file, the script will
-- fail at this point).
copyFile (my saveFolder & my clientDocTitle & ".ps" as
text) to (alias "input_ps:") with replacing
end if
end tell
end if
-- Reset Hardcopy Printer
tell application "Desktop Printer Manager"
-- point at the real printer
set default printer to desktop printer the "Real Printer"
end tell
-- Make Quark Active to complete "on clean_Up"
tell application "QuarkXPress 4.1"
activate
end tell
end print_document_ps
+++++++
As I see it, the flaw in the script that catches you is that there isn't
enough time set for the eps output file from the virtual printer to be
generated the first time you try to run the script, and recompiling the
script isn't necessarily the solution... Try upping the delay value or
placing it into the following loop:
set FlagNotDone to True as boolean
Repeat while (FlagNotDone)
if exists (file (my clientDocTitle & ".ps" as string) of
folder (my saveFolder as string)) then
set FlagNotDone to False as boolean
else
delay 5
end if
end repeat
That code snipped will sit there an keep waiting 5 seconds repeatedly until
it finds the file.
Best Wishes,
=-= Marc Glasgow
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.