I have written a script that makes one PS-file for each page of a Quark document. (I´m sure the script could have been shorter using a repeat command, but I´m new to scripting) The problem is that all the files get the name of “untitled.ps”, “untitled.ps1”, “untitled.ps2” etc. Is there a way to handle the naming of the files? I want the files to be named: “document name, page number” Can anyone help??
Here is the script:
tell application "QuarkXPress Passport™"
activate
count pages of document 1
copy result to temp print page 1 of document 1
if temp > 1 then
print page 2 of document 1
end if
if temp > 2 then
print page 3 of document 1
end if
if temp > 3 then
print page 4 of document 1
end if ---and so on...
tell application "Acrobat™ Distiller™ 4.0"
activate
end tell
end tell
(I have set up a desktop printer as a PostScript translator and are using the “hot folder” option in Destiller to make pdf files from the ps-files)
Since I don’t use Quark, I can’t advise you on whether or not the “print” command in Quark allows a file destination.
However, renaming files in the Finder is trivial. At the end of your Quark Express script, add lines which:
ask what is the name of the current Quark Document
– e.g. set newname to name of document 1 in a finder tell block
look for a file with “untitled” in its name
– e.g., every file of folder xx whose name contains “untitled”
extract the number after the .ps
– e.g. set x to last char of name of file file_path
rename the file
– e.g. set name of file file_path to newname & “.ps” & x
end
You’ll also need to tell the applet where the untitled .ps files are. Quark may know, or you may have a set folder where the files are stored, or you may wish to use a property or droplet.
grh
Quark does allow the naming of postscript files generated by they print command via AppleScript.
Could you be a bit more spesific as to how this could be done please…
Thanks
Vegard
My apologies. I didn’t have any of my scripts on hand when I posted.
I wrote a script to save every page of a QXP file as EPS files with a unique name based on the document name.
set destpath to (choose folder)
--declare a place to save filestell application "QuarkXPress™ 4.11"
set docname to name of document 1
tell document docname
repeat with i from 1 to (count of pages)
save page i EPS format in ((destpath as text) & docname & ".eps pg" & i)
end repeat
end tell
end tell
It should also work as:
save page 1 EPS format in (new file)
This should also work with the print reference.
From QXP script dictionary:
print reference – list of objects to print[copies small integer] – the number of copies to print[cover page no/first page/last page] – use a cover page[OPI omit TIFF/omit TIFF and EPS/include images] – OPI options[paper source paper cassette/manual feed] – paper tray[plates list] – list of plates to print[PostScript file alias] – file to print PostScript to
where the last variable you can declare is the file to which it prints. Try:
print page 1 of document 1 PostScript file (new file)
or else declare a path to a file (as text) instead of bringing up the (new file) dialog every time.
Hope this helps. Lemme know if it works or not; I’ll troubleshoot.
Kirk
I, too, have been trying to get this to work. The following is a script that I want to use in a batch droplet for Postscripting a bunch of files. The scenario is that after a reboot, I launch Quark with a document to print, open this test script, run it and the script prints to the Desktop translator and puts the file where I told it, name intact,(not where the desktop printer was told). I run it again, same document, works again with a “.1.ps” after the name. Now close that doc and open the next one. Run the script and the desktop translator says to go to the finder 'cause there is trouble. It says that it can’t print the document “because there was an error. -48”
tell application "QuarkXPress™ 4.11"
activate
--change document name from "xxx-yyyy blah blah" to "xxxyyyy.ps"
get (name of document 1 as text)
set docId1 to characters 1 through 3 of result as text
get (name of document 1 as text)
set docId2 to characters 5 through 8 of result as text
--save file to root level of my local hard drive
set psFilePath to "Prepress_3:Desktop Folder:" & docId1 & docId2 & ".ps"
tell document 1
set (print setup) to {halftone screen:"133", printer type:"AGFA-ProSet9800SF", resolution:2400, print colors as grays:true, adjust horizontal tile:false, data format:ASCII data, orientation:portrait, paper size:"Letter", print quality:normal}
print copies 1 cover page no OPI omit TIFF PostScript file (psFilePath)
end tell
end tell
I get the “-48” WITHOUT a script if I just set the settings and print to the translator without specifying a file name using the printer button on the printer settings dialog. It may not even be a problem with the script! Maybe it’s a Quark bug. I’m stumped.
hmmmmm…I know there’s a script I wrote at work that generates a calander page via FileMaker, formats the page layout in Quark, and then dumps each page (yes, one for every day in the year) to a postscript file for downloading to a printer later. I’m away for a week right now, but I’ll post it when I get back to the office.
To be honest, I’m not sure the script will work now because I wrote it to work with QXP 3.2 and LaserWriter8, and I’m now using QXP 4.11 and AdobePS Printer (version 5, I think). It’s just recently that I installed new machines and haven’t had a chance to test all my scripts - but I will.
The bug may be in Quark, but it also might be in the printer driver since the error occurs without the script. Are you using LaserWriter8?
Yes, I am using LaserWriter8 as the driver and the AGFA as the PPD. Here is another weird thing. On a couple of machines here in the office, the first .ps file created goes where I tell it to go, but all subsequent ones go to a drive on the network (???) and it’s not always the same drive. It will only put the first .ps file where I tell it after a reboot. The files are all named properly and all fonts are included. This happened on the machine I wrote the script on and I suddenly found all the other .ps files on a drive called “Temp”. I threw “Temp” into the Trash and ran dropped a few files onto the droplet and the first one worked but since it couldn’t see “Temp” anymore I got the “-48” error and the script hasn’t worked on that machine since. Running 4.11 on OS 9.0.
I don’t know why I always find such weird problems!
I still can´t figure it out!
It works as you describe when saving EPS files but not with
PostScript files…
The line: “print page 1 of document 1 PostScript file (new file)” will not even compile…
(I´ve also tried to declare a path to a file as text as you describe, but with the same result)
What am I doing wrong???
Thanks a lot for your help!
Vegard
I think the script relies on defining the entire path to file names rather than relying on a desktop printer’s setting for where to save postscript files. Example:set psFolder to (choose folder) as texttell application "QuarkXPress™ 4.11"repeat with x from 1 to (count of pages of document 1)set psName to psFolder & "page " & xprint page x of document 1 PostScript file psNameend repeatend tellThis script simply prints every page of a QXP document to PS files named page 1, page 2, etc… I had used this method with QXP v3.3, Apple’s Laserwriter8, OS 7.5, and the desktop printer for a Unity 1200 printer (not a postscript printer made only for printing PS files, just the regular printer).I was worried that it wouldn’t work with our upgrades, but it does. QXP v4.11, Adobe PS Printer, OS 8.6, and any printer selection. I know that the print and save as EPS scripting commands of QXP have always been particularly picky about using variables for operator values. If it doesn’t work try writing the print command with as little variables as possible.