Using Text Defaults; Adding Xmp Metadata; Creating A Document Template - Adobe 27510753 - InDesign CS2 - PC Manual

Scripting guide
Hide thumbs Also See for 27510753 - InDesign CS2 - PC:
Table of Contents

Advertisement

160
Working with Documents in VBScript

Using text defaults

To set text in a document to a default character style or paragraph style, use the following script:
Rem SetTextDefaultToStyle.vbs
Rem An InDesign CS2 VBScript
Set myInDesign = CreateObject("InDesign.Application.CS2")
Rem Assumes that the active document contains a paragraph style "BodyText"
myInDesign.ActiveDocument.TextDefaults.AppliedParagraphStyle = myInDesign.ActiveDocument.
ParagraphStyles.Item("BodyText")

Adding XMP metadata

Metadata is information that describes the content, origin, or other attributes of a file. In the InDesign user
interface, you enter, edit, and view metadata using the File Info dialog box (File > File Info). This metadata
includes the creation and modification dates of the document, the author of the document, the copyright
status of the document, and other information. All this information is stored using XMP (Adobe Extensible
Metadata Platform)—an open standard for embedding metadata in a document.
To learn more about XMP, see the XMP specification at http://partners.adobe.com/asn/developer/pdf/
MetadataFramework.pdf.
You can also add XMP information to a document using InDesign scripting. All XMP properties for a document
are in the document's MetadataPreferences object. Here's an example that fills in the standard XMP data
for a document.
This example also shows that XMP information is extensible. If you need to attach metadata to a document
and the data does not fall into one of the categories provided by the metadata preferences object, you can
create your own metadata container ( email , in this example).
Rem MetadataExample.vbs
Rem MetadataExample.vbs
Rem An InDesign CS2 VBScript
Rem Adds metadata to an example document.
Set myInDesign = CreateObject("InDesign.Application.CS2")
Set myDocument = myInDesign.Documents.Add
With myDocument.MetadataPreferences
.Author = "Olav Martin Kvern"
.CopyrightInfoURL = "http://www.adobe.com"
.CopyrightNotice = "This document is copyrighted."
.CopyrightStatus = idCopyrightStatus.idYes
.Description = "Example of xmp metadata scripting in InDesign CS"
.DocumentTitle = "XMP Example"
.JobName = "XMP_Example_2004"
.Keywords = Array("animal", "mineral", "vegetable")
Rem The metadata preferences object also includes the read-only
Rem creator, format, creationDate, modificationDate, and serverURL properties that are
Rem automatically entered and maintained by InDesign.
Rem Create a custom XMP container, "email"
.CreateContainerItem "http://ns.adobe.com/xap/1.0/", "email"
.SetProperty "http://ns.adobe.com/xap/1.0/", "email/*[1]", "okvern@adobe.com"
End With

Creating a document template

This example creates a new document, defines slug and bleed areas, adds information to the document's XMP
metadata, sets up master pages, adds page footers, and adds job information to a table in the slug area:
Rem DocumentTemplate.vbs
Rem An InDesign CS2 VBScript
Adobe InDesign CS2 Scripting Guide

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Indesign cs2

Table of Contents