Re: linking images in pagemaker
Re: linking images in pagemaker
- Subject: Re: linking images in pagemaker
- From: has <email@hidden>
- Date: Wed, 19 Sep 2001 13:52:53 +0100
Andrew Simpson wrote:
>
We have several hundered pagemaker files with missing links to images.
>
>
I was wondering if there is a way to automate the linking of the image
>
files.
Very probably.
OK, I'd just finished writing the rest of this mail when I had a bit of a
brain futz: what happens if you create an alias to the renamed file, naming
the alias using the original filename? PM will open the doc and make links
ok, but will those links be to the alias, or is PM smart enough to resolve
the path to the original (ie the renamed file) and make the link to that?
It's worth exploring, I think: if PM was indeed that crafty (though I doubt
it), you could avoid a heap of complex PM scripting and just use an AS that
generates these aliases to all your image files, opens the PM doc, saves it
again once the links have updated, then deletes the aliases again. OK, it
probably won't work, but try it anyway cos you never know.
But anyway, if that idea doesn't pan out, read on...
>
The problem we have is that the names of the files have change slightly on
>
disk. With some filename manipulation it is possible to recognise which
>
files should be linked to the pagemaker document when it asks for it but we
>
need to keep the filenames consistent on disk and change the reference to
>
the file in pagemaker.
>
>
i have had a look at the dictionary provided with pagemaker and it looks
>
fairly dismal. Pagemaker apparently has a scripting/macro language but i am
>
not sure how usefull it is.
PM6 scripting has layout commands only; to drive complex scripts you have
to use a 3rd-party scripting language such as Applescript. PM6.5 has a full
scripting language built in; I've not used it so can't tell you how
powerful it is (you'd be better asking on Adobe's discussion forums),
though you can still alternately use an external language, PM6-style, if
you prefer. I did a couple of PM/AS hybrid scripts at my last job, so it's
not too hard to do once you've got a grasp of AS and the layout commands
for PM (also see the recent 'reality check' thread for various AS/PM
scripting fun [hi jerry!]). If your AS skills are already solid then this
may be quicker than learning the full AS scripting language; also you might
want access to 3rd-party OSAXen (eg use RegEx Commands for your filename
manipulations).
Links:
http://www.hhansen.com/pmscripting/index.html
http://www.oz.net/~vsamarsk/PageMakerScripting.htm
http://www.svprint.com/pmscripting_folder/scripts_folder/as_scripts.html
The first link is for the guy who wrote the PM6.5 Scripting Guide: you can
d/l a copy from his site (essential reference), along with sample scripts.
The second is the for the guy who wrote the PM6.5 script engine; there's a
ton of prewritten PM scripts there that are well worth looking through. The
third is also a very good resource with scripts and a heap of info about PM
scripting, including how to drive PM scripting through another scripting
language such as Applescript; the link above takes you right into the site,
so once you get there you should back up a bit and take time to explore the
whole thing.
It's even possible that you might find something that can be made to fit
your needs. If so, great; if not, it's rolling-up-the-sleeves time. If you
decide to do a PM-only solution then go spend some time on Adobe's
site/discussion boards and see if you can dredge up help there. For a
hybrid solution which uses AS to drive PM, you need to send PM scripts to
PageMaker from AS by using the 'do script' command (you can write
'evaluate' if you prefer, but both do the same thing), eg:
do script "PageSize 8i, 12i
PageMargins 2i, 2i, 2i, 2i"
or
set x to 8
set y to 12
do script "PageSize "& x & "i, " & y & "i
PageMargins 2i, 2i, 2i, 2i"
Either of which would set page size to 8x12" with 2" margins.
You can also get values returned from PM (but I've kinda forgotten exactly
how that works:/ - it's not hard though).
As for fixing your links...
I think it'd be easiest if you kept two copies of all your images, or one
copy and an alias (see where the brain futz mentioned above occurred?:) -
one with original name and one with new. This will avoid all sorts of fun
and games in opening the PM doc (without having to deal with the broken
link message), and with getting the info for image objects. (It shouldn't
be hard to write an AS script to generate a bunch of temporary aliases for
you and delete them again when done.)
Anyway, open each PM doc in turn. You really want to batch process a job
this big, but since I've no idea how your PM files are arranged or located
I'll leave that to you to figure out - if it's nothing fancy maybe a
recursive folder crawler that builds a list of all PM docs found in a
certain directory and its subdirectories? Scripts for doing that should be
easy to source - just ask the list, or search the older threads.
Once you've got your PM doc open, use GetLinks to get a list of all the
linked images and the pages they're on (though if all your pages have
images on then you'll be quicker to skip this and just step through every
layout in the document).
Go to each of those layout (if it's 2-page spreads then you'll only need to
go to the odd-numbered pages in the list, plus the last page). Use
GetObjectList (unless you've any inline images, in which case you'll have
to use GetObjectLoc) to return a list of all objects on the layout, and
have your script filter those for images only.
Get the DrawNumber for every image object (or position - but if you use
this and you've ever got two images which have the same handle in the same
place then you'll need extra handling to cope with this by trying to use
DrawNumber instead if possible, and logging an error for that file before
proceeding to next if that fails as well).
Select the object by DrawNumber (or position) and get the old filename
using GetLinkInfo. Do your funky name munging thing, then use ReLink to
link that object to the new image.
Lastly, save and close. <whew!>
Good luck
has