I wrote a crude little Javascript that copies the contents of paragraphs marked with four unique paragraph styles into the Title, Author, Subject (a.k.a. Description) and Keywords categories. I decided not to copy actual text from the article because I usually need to edit it for the metadata: an article's title often includes forced line breaks, and there may be a sub-title set in a separate paragraph style; or there may be phrases in italics, which I need to enclose in quotes for formatless metadata. So I make a non-printing text frame in the margin on the opener, where I prepare the stuff I want to go into the XMP metadata.
It works in IDCS4, but I assume it wouldn't be hard to write something similar for IDCS3. I don't recall whether Style Groups came in with CS4, but I used them, irritating as they can be. The one bit of subtlety was using an array for keywords which made it convenient to separate my keywords with commas in my text box and still get fed properly into XMP. No error checking — the script dies if it can't find an instance of a paragraph style, and I don't know what happens if there are two. I'll paste my script below in case anyone wants to play with it. I hope the big boys will excuse my noob oversights.
David
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(“XMP_Basic4”).paragraphStyles.item(“Title”);
app.findGrepPreferences.findWhat = “r”;
app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(“XMP_Basic4”).paragraphStyles.item(“Author”);
app.findGrepPreferences.findWhat = “(?<=^).+(?=$)”;
app.activeDocument.metadataPreferences.author = app.findGrep()[0].contents;
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(“XMP_Basic4”).paragraphStyles.item(“Title”);
app.findGrepPreferences.findWhat = “(?<=^).+(?=$)”;
app.activeDocument.metadataPreferences.documentTitle = app.findGrep()[0].contents;
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(“XMP_Basic4”).paragraphStyles.item(“Description”);
app.findGrepPreferences.findWhat = “(?<=^).+(?=$)”;
app.activeDocument.metadataPreferences.description = app.findGrep()[0].contents;
MyKeywordsPara = ” “;
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyleGroups.item(“XMP_Basic4”).paragraphStyles.item(“Keywords”);
MyKeywordsPara = app.findGrep()[0].contents;
app.activeDocument.metadataPreferences.keywords = MyKeywordsPara.split(“,”)
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;