Saturday, June 02, 2007

 

Edit Original Continued

It turns out that there is a naming bug in the object model. There is a collection object for importedPages but it has the unfortunate name IndesignPageItems. I had noticed that in the object model viewer (in ESTK 2, choose Adobe InDesign CS3 Object Model from the Help menu) but didn't recognize what it was.

So this raises the question, how to write code that uses this that doesn't get broken when they fix the name? How's this:
    function getImpPage(obj) {
if (obj.constructor.name == "ImportedPage") return obj;
try {
return (obj.hasOwnProperty("importedPages") ? obj.importedPages[0] : obj.indesignPageItems[0]);
} catch(e) {
return null;
}
} // end of getImpPage
Yes! That works.

Dave

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?