Collections
Often a document contains multiple objects of the same type; e.g., a
Document object contains multiple Page objects. In scripting, this
relationship is expressed by a Collection object. A Collec-
tion object has methods and properties that count the objects in the
collection, add a new object or remove an object from the collection,
and access a specific object in the collection.
Collection objects are often named in the plural of the type of
the objects that they hold. For example, a Document object contains
the Collection object Pages, which hold all the Page objects
of the document.
Scripting for Windows
Creating a sample script in Visual Basic &
VBScript
Scripts can be written in any language that supports scripting on Win-
dows such as Visual Basic, VBScript, or JavaScript. This section
walks you through the creation of an example script in both Visual
Basic and VBScript. To open and run the Visual Basic example, you
need to have the Visual Basic development environment installed.
The VBScript example is a plain text file and can be viewed in any
editor. It executes on any Windows 98/NT/2000 system that has the
Windows Scripting Host (WSH) installed. The WSH is installed by
default on any of these systems. We recommend reading both sec-
tions even if you dont have the Visual Basic environment since a lot
of general issues are explained in them as well.
The example script has the function of downsampling all JPEG
images in a chosen source folder to a resolution of 72 ppi and then
saving them to a chosen destination folder. The script achieves this
task by taking each of the JPEG images from the source folder. Next,
it automatically opens Canvas 8, changes the resolution of the image
to 72 ppi, and then saves it to the destination folder under a slightly
different name. A person who has to perform this task would nor-
mally have to do all of those steps for each image manually; whereas,
a script will perform this process automatically.