I’m totally stuck… and I don’t know if I am overly looking something totally simple or if it’s just not possible.
Here’s what I’m doing. Quark is creating a postscript file into a folder completely chosen by the use. It has to be user specified because of multiple users. The folder’s variable name is destFolder. it prints a file w/ a user specified name, as well, called hiRez. Again, the file name has to be user specified. The postscript is then run through distiller, and a PDF is generated. I want to know if there is a way to grab that file as a variable. Meaning, is there a way to tell applescript to find that newly generated file? I need this to happen because I need the script to loop until distiller is done generating the PDF.
this is what i have…
set hiRez to (DestFolder & fileName2 & “-HR” & “.ps”) as text
set loRez to (DestFolder & fileName2 & “.ps”) as text
print front document PostScript file hiRez
tell application “Finder”
set fileCheck to false
repeat until fileCheck is true
if exists alias hiRez then set fileCheck to true
end repeat
end tell
print front document PostScript file loRez
end tell
tell application "Finder"
set fileCheck2 to false
repeat until fileCheck2 is true
if exists alias loRez then set fileCheck2 to true
end repeat
end tell
tell application "Acrobat Distiller 6.0.2"
activate
Distill sourcePath POSIX path of hiRez destinationPath POSIX path of DestFolder adobePDFSettingsPath "/Users/Shared/Adobe PDF 6.0/Settings/HiRez PDF.joboptions"
end tell
–this is where i want it to loop until the hiRez PDF is produced, but I don’t know how!!
tell application "Acrobat Distiller 6.0.2"
activate
Distill sourcePath POSIX path of loRez destinationPath POSIX path of DestFolder adobePDFSettingsPath "/Users/Shared/Adobe PDF 6.0/Settings/Rev4.joboptions"
end tell
for some reason when i run this, the script will time out with larger postscript files. i don’t know if it is because i’m throwing too much at distiller at once or what.
any help would be greatly appreciated!!!
maybe I don’t fully understand your problem - why don’t you simply specify the destination path when distilling? Then you know the link to the new pdf file:
Distill‚v : Distill a file.
Distill reference : the object for the command
sourcePath Unicode text : Required POSIX path to the input file (for example “/hello.ps”).
[adobePDFSettingsPath Unicode text] : Optional POSIX path to the Adobe PDF Settings file. If adobePDFSettingsPath is not specified the default is used (the one selected in the UI).
[ destinationPath Unicode text] : Optional POSIX path to the output file (for example “/hello.pdf”). If desinationPath is not specified the PDF will be generated in the same folder as the source file.
→ boolean
By default, AppleScript waits one minute for a response before stopping execution of application and scripting addition commands that are sent to other applications. A With Timeout statement lets you change how long AppleScript waits.
SYNTAX
with timeout [ of ] integer second[s]
[ statement ]…
end [ timeout ]
…
Dominik - thanks for your help - but it’s still getting stuck. At first i thought it would work, because Quark actually started showing its normal print screen, like it was processing the file to print. (Usually I just got a box that said something about Printing, and what to press to quit printing)… but it’s STILL just hanging up on the bigger files. It will make the postscripts, but Distiller just sits there. If I quit out an manually drag the postScript file into distiller, it works just fine - but that totally defeats the purpose of having a script, ya know? I’m so lost as to what is wrong. I added the timeout, like you said, but it just didn’t help at all.
A couple of questions: Can you please describe the workflow you are trying to achieve? How many users, how many files, computers, servers.
How many copies of Distiller do you have running? If you have two copies, you could delegate hiRez to one distiller and loRez to another. Then you could just have two separate scripts, one for hiRez and one for loRez. Instead of having the user choose the destination folder, use an absolute path. The two scripts will not require user interaction, and won’t have to tell distiller to change its joboptions. Then, if you know the path already, you’ve got your variable for the final PDF. What happens next?
if you can get that setup, change your print command to this:
print front document PostScript file hiRez without print dialog
We have our distiller running on the server, which is nice. But we don’t have to change our joboptions. I’m sure Distiller Server can run different job options based on watched folders, but it’s really expensive. Another copy of Acrobat surely wouldn’t be cost prohibitive.
i can’t quite understand from your post if everything work properly in your script until the line:
or if your having problems with the file checking routines above it as well…
in any case, if your trying delay an execution of a command to start creating a file, until another file exists, and you’re having timeout issues with a repeat block, you can try saving the script as a stay-open application and use an “on idle” handler instead.
the general idea would be something like:
property file1 : ""
property destination1 : ""
on run
my make_file1()
end run
on idle
tell application "Finder"
if exists file file1 in folder destnation1 then
my make_file2()
end if
end tell
return 5 -- or any other number for the interval between file checks in seconds
end idle
on make_file1()
--your code for telling an application (distiller or quark) to create the first file
-- storing it (or a reference to it) in variable "file1".
-- and its destination in variable "destination1" (may not be necessary)
end make_file1
on make_file2()
--your code for creating the second file.
end make_file2
i don’t know exactly how distiller and quark work, but another problem could be that they create the file as soon as they get the command, and then begin to process its content. (the file will already exist when the loop starts, and will just grow in size).
in that case your “on idle” handler will have to include some code to determine if the file stopped “growing” before continuing. or maybe you can play around with the “busy status” property (never used it…).