Re: Final Reality Check (Was... I lost count)
Re: Final Reality Check (Was... I lost count)
- Subject: Re: Final Reality Check (Was... I lost count)
- From: has <email@hidden>
- Date: Fri, 7 Sep 2001 23:38:25 +0100
Jerry Meyer wrote:
>
I have till the end of
the year to singlehandedly develop, test & implement a digital document
delivery system for my company (a $200M heavy equipment manufacturer)
incorporating thousands of pages, manuals, CD's & possible web-delivery.
Hoo-boy... somebody musta saw you coming, lad. That's pretty steep to ask
of someone who's never done it before.
(OK, now I'm really bummed that I deleted my PM/AS hybrid scripts. Hell, I
coulda *sold* you them.;)
>
I have spent 8 to 10 days trying to "Teach" myself AS, and the deadline
keeps getting closer.
The bad: 8-10 days is nothing to learn scripting of any sort. Pretty
unrealistic.
The not-so-bad: it shouldn't take 3 months either. Seriously, what's your
realistic timescale for getting your PM/AS scripting up and running?
>
I need to interrupt the process to enter metadata into several fields.
I was wondering to myself what sort of metadata you were entering; if it
were possible to machine-enter it or if it's gotta be done by hand. Might
it be possible - if it's the former - to use some 'puppet menu'-type osax
to turf it into the relevant dialog in Acrobat (you'd need to pull down the
File menu, then the Doc Info menu, then bung in the text using TABs to jump
between the fields). Although this is still secondary to the business of
getting the pdfs made. Whatever, I'd still leave that bit to deal with in
Acrobat. Get the PDF-generating working on its own first. (Still, feel free
to pop up a few samples of the sort of metadata you'll be using as food for
later thought.)
Marc K. Myers wrote:
[basic loop]
tell application "Finder"
set fileList to files of folder "FilesToConvert"
repeat with aFile in fileList
open (contents of aFile)
tell application "PmScript" -- The app that runs scripts in PM
run script "PrintToPSFile"
end tell
end repeat
end tell
Just what the doctor ordered - almost. But the loop is the business. It's
what's inside it that's the fun bit...
Now, the really brilliant bit about PM scripting is this: it's much, much
cannier than scripting Photoshop, say (where all you can do is say 'run an
action of name ...'. I've said this before, but here it is again: you can
pass the actual script itself from AS to PM. So apart from having to learn
two languages instead of one to achieve it, you can still do a ton-load if
you really want to.
Now, I don't have a PM dictionary to look at, and I don't have a PM
scripting guide either. So this probably won't work as-is cos I'm going
from memory here and using the bits you've provided. But it should still
help. Try something like:
tell application "Finder"
set fileList to files of folder (choose folder)
end tell
--increase the timeout if necessary (I've made it 5 mins here, but that's a
guess - if your PM files are really huge I've seen it take even longer)
with timeout of 300 seconds
repeat with aFile in fileList
tell application "PageMaker 6.52"
open aFile
--do some grinding to generate a suitable filename
set newfilename to name of aFile
if newfilename ends with ".p65" then
set newfilename to (items 1 thru -5 of name of aFile) as text
else
if count of newfilename > 28 then set newfilename to (items 1 thru 28 of
name of aFile) as text
end if
--(note how double quotes are escaped within the string by using "\")
run script "Print 1, 0, -2, \"" & newfilename & ".ps\"
to folder "FilesToConvert"
close"
--NOTE: I have no memory of the 'to folder' line you've got here, or how it
might work. It may be that you can use the full path as newfilename. I've a
suspicion this is what I did, but again I can't really remember from months
ago. Assembling file paths from bits is something you can do either in
vanilla AS, or using 3rd-party OSAX, such as RegEx Commands, to grind the
text for you.
--I think 'close' will close the PM file without saving/save dialog, but...
not certain... bad memory... yada-yada...
end tell
end repeat
end timeout
OK, it's not very robust in terms of getting and opening files - it'll just
tell PM (hopefully) to open every file (which assumes they are all PM
files; if it's a mixed folder, you should add extra stuff to check file
types first). Still, enough to get you going for now. You can always
strengthen the code later, once you've got the basics working ok.
You may well need to develop your PM script to select the appropriate
(Distiller) PPD, and possibly other bits and pieces too. I seem to recall
my script setting 3 or 4 different print setting doodads in PM, though now
I can't really remember why.
As for Distiller, no scripting needed there. Metadata: worry about that
later. But for now, if you can get your script as far as generating
error-free PDFs then you're well on your way.
HTH
has