Visual Basic Guide

Text-only Preview

Creative assets management
Visual Basic
Guide
P8_VBG_0506

Contact
Extensis
Celartem, Inc.
1800 SW First Avenue,
Email: [email protected]
Suite 500
http://www.celartem.com/jp/
Portland, OR 97201
Toll Free: (800) 796-9798
Press Contact
Phone: (503) 274-2020
Phone: (503) 274-2020 x129
Fax: (503) 274-0530
Email: [email protected]
http://www.extensis.com
Customer Service
Extensis Europe
Web/email: http://www.extensis.com/customerservice/
First Floor, Century House
Phone: (800) 796-9798
The Lakes
Northampton NN4 7SJ
Technical Support
United Kingdom
Phone: +44(0)1604 636 300
Web/email: http://www.extensis.com/support/
Fax +44 (0)1604 636 366
[email protected]
Documentation Feedback
Web/email: http://www.extensis.com/helpfeedback/
© 2006 Extensis, a division of Celartem, Inc. This document and the
code for such components are specified in the copyright notice file,
software described in it are copyrighted with all rights reserved. This
LICENSES.TXT delivered with this product. Please refer to these
document or the software described may not be copied, in whole or part,
licenses for information regarding use of these software components.
without the written consent of Extensis, except in the normal use of the
software, or to make a backup copy of the software. This exception does
Extensis warrants the disks on which the software is recorded to be free
not allow copies to be made for others. Licensed under U.S. patents issued
from defects in materials and faulty workmanship under normal use for
and pending.
a period of thirty (30) days from the original date of purchase. If you
purchased this product directly from Extensis, and if a defect occurs
Extensis is a registered trademark of Extensis. The Extensis logo, Extensis
during the 30-day period, you may return the disks to Extensis for a free
Library, Font Reserve, Font Reserve Server, Font Vault, and Font Sense,
replacement. All products submitted for replacement must be registered
Portfolio, Portfolio Server, Portfolio NetPublish, NetPublish, Suitcase
with Extensis before replacement. Extensis products purchased from
and Suitcase Server are all trademarks of Extensis. Celartem, Celartem,
resellers are warranted by the reseller and are covered by the reseller’s
Inc., the Celartem logo, PixelLive and PixelSafe are trademarks of
return policy. This warranty is limited to replacement and shall not
Celartem, Inc. Adobe, Acrobat, Illustrator, Photoshop, and PostScript
encompass any other damages, including but not limited to loss of profit,
are trademarks of Adobe Systems, Incorporated. Apple, AppleScript,
and special, incidental, or other similar claims. This software is provided
Bonjour, FontSync, Macintosh, Mac OS 9, Mac OS X, PowerPC,
on an “as is” basis. Except for the express warranty set forth above,
and QuickDraw are registered trademarks of Apple Computer, Inc.
Extensis makes no other warranties, either explicit or implied, regarding
Microsoft, Internet Explorer, Windows, Windows XP, Windows 2000,
the enclosed software’s quality, performance, merchantability, or fitness
Windows NT, Windows ME and Windows 98 are registered trademarks
for a particular purpose.
of Microsoft Corporation. Intel is a registered trademark of Intel.
All other trademarks are the property of their respective owners.
Portions of this product use software components developed through
various open source projects. The licenses and availability of source
Bonjour

Portfolio
Visual Basic Guide
iii
Contents
Visual Basic and Portfolio ......................................................................1
Introduction to the Portfolio Automation Interface ..........................2
How to add Portfolio to your Visual Basic project .................................2
The Portfolio Object Model: ..................................................................2
Creating Portfolio Objects .....................................................................3
Opening Catalogs .................................................................................3
Opening Catalogs on a Server ..............................................................4
Opening catalogs with User-based access .............................................4
Creating Catalogs ..................................................................................4
Working with Catalogs ..........................................................................4
Selecting a Gallery .................................................................................5
Sorting a Gallery ....................................................................................5
Working with Galleries ..........................................................................5
Saving A Gallery ....................................................................................6
Adding files to a Gallery ........................................................................6
How to access the Advanced Options ...................................................7
Cataloging - Advanced Options ............................................................7
Accessing Individual Records .................................................................8
Working with Selections ........................................................................8
Working with Records & Selections......................................................8
Selecting items ......................................................................................9
Determining the fields for a catalog .................................................... 10
Changing Field Values ......................................................................... 10
Working with Fields .............................................................................10
Passing Field Values to Portfolio .......................................................... 11
How to Search .................................................................................... 12
Building the Query .............................................................................. 12
Searching the Catalog .........................................................................12

Visual Basic Guide
Creative Assets Management
iv
Appendix A: The Portfolio Class Libraries ..........................................13
The Portfolio Document Class: ............................................................ 13
The Portfolio Gallery Class: .................................................................. 13
The Portfolio Record Class: .................................................................. 15
The Portfolio Field Class: ..................................................................... 15
The Portfolio Records Class: ................................................................ 16
The Portfolio Selection Class: .............................................................. 16
The Portfolio AdvancedOptions Class: ................................................ 16
APPENDIX B: Frequent Questions and Answers ................................17
Portfolio Automation Demo: ............................................................... 19
Path Change Utility: ............................................................................ 19
Backup Utility: ..................................................................................... 19
APPENDIX C: Guide to The Sample Applications ..............................19
APPENDIX D: Portfolio Programming Error Codes .......................... 20

Portfolio
Visual Basic Guide

Visual Basic and Portfolio
This document provides a brief overview of the
For more information about Portfolio, please refer
Portfolio commands available via the Automation
to the Portfolio User Guide installed with your
interface in Extensis Portfolio 8.0 for Windows.
Portfolio client. For the most up-to-date information
The examples covered here are written in Microsoft
about Portfolio, please visit the Extensis website at
Visual Basic 6. The source code for the sample
http://www.extensis.com/portfolio/.
applications is provided in both Visual Basic 6 and
Visual Basic .NET (2003) format. Users familiar with
other languages capable of using Automation should
be able to extrapolate from the examples for their
particular languages. This document assumes a basic
level of working familiarity with Visual Basic.
This document is not meant to be an introduction
to Visual Basic or as a tutorial for how to script
Portfolio to perform specific tasks. For more
information about the basics of Visual Basic, please
visit http://msdn.microsoft.com/vbasic/. This site contains
a great deal of useful information on Visual Basic as
well as links to other programming-related websites.
For more information on how to script Extensis
Portfolio, please refer to the additional files provided
on the Extensis CD, or with your product download.

Visual Basic Guide
Creative Assets Management

Introduction to the Portfolio
Automation Interface
How to add Portfolio to your
The Portfolio Object Model:
Visual Basic project
The diagram below shows the relative
All objects, properties and methods of the Portfolio
structure of the Classes within the
interface (as described in the rest of this document)
Portfolio Library Object Model.
are supported in the Portfolio_V8 automation
interface.
Portfolio.Document
To expose the Portfolio object, and its family of
classes, to your Visual Basic code, you must first
Gallery
include it in the reference options in your VB
project. Use the Project References dialog within
the VB interface to select the Portfolio_V8 library.
AllRecords
Once this has been done, your VB application will
be aware of the Portfolio document interface and
SelectedRecords
you can reference the family of classes within your
VB code.
Options
Fields
Field
One thing you’ll notice in the Portfolio Object
Model is that there is no Catalog object or class.
The Portfolio document object is actually a
collection of Galleries. If you need to reference the
Catalog name, you can use the Gallery.Catalog
name property.

Portfolio
Visual Basic Guide

Creating Portfolio Objects
Opening Catalogs
As with any application being accessed through
To open a Portfolio catalog via Automation, use
Automation, you need to create a variable to hold
the Open function of the Document object. If the
the object which references the Portfolio _
catalog has already been opened with this copy of
V8.document class and then create the object using
Portfolio (either through scripting or manually), the
the set command
first gallery of the catalog will come to the front and
become the active gallery.
Example:
Dim PortObj as Portfolio _ V8.document
Function Open(Path As String, AccessMode
As Integer, Password As String) As

Set PortObj = New Portfolio _ V8.Document
Integer
If Portfolio is already running, the VB application
The acceptable values for AccessMode are as follows:
will use that instance of the application. Portfolio is
a single-instance application, so there is no way to
READER = 1
force a new instance of the application from within
VB.
EDITOR = 2
PUBLISHER = 3
To access the Gallery class, create an object variable
to hold a reference to the Portfolio _ V8.Gallery
ADMINISTRATOR = 4
class, and then create the reference using the set
command.
Example:
x = PortObj.Open(“C:\test.fdb”,4,””)
Example:
Dim PortGal as Portfolio _ V8.Gallery
Set PortGal = New Portfolio _ V8.Gallery
Throughout much of this document, the
examples will refer to objects named PortObj
and PortGal. These are the objects described
above, and represent Portfolio _ V8.Document
and Portfolio _ V8.Gallery objects. These
objects are the communication interfaces that
allow your VB code to access the features and
functionality of Portfolio.

Visual Basic Guide
Creative Assets Management

Working with Catalogs
Opening Catalogs on a Server
Function OpenByUserName(Path As String,
UserName As String, Password As String)

To open a catalog which is being served by a
As Integer
Portfolio Server, use the OpenServer function of the
Document object. The command takes the ‘address’
Function OpenServerByUserName(Path As
of the catalog in the form “server/catalog,” where
String, UserName As String, Password As
“server” is the server’s name or IP address.
String) As Integer
Example:
Function OpenServer(Path As String,
AccessMode As Integer, Password As

x = PortObj.OpenByUserName(“C:\test.
String) As Integer
fdb”,”User1”, “password”)
The acceptable values for AccessMode are the
x = PortObj.OpenServerByUserName(“192.0.0
.0/Test.fdb”,”User1”,”password”)
same as above. Be aware, however, that server
catalogs can’t be opened via your VB code in the
Creating Catalogs
Administrator mode.
To create a new catalog, use the new command. By
Example:
default, the catalog opens in Administrator mode.
x = PortObj.OpenServer( “192.0.0.0/Test.
fdb”,3,””)

Function New(Path As String) As Integer
Opening catalogs with
Example:
User-based access
x = PortObj.New(“C:\test.fdb”)
To open a catalog with user-based access
security, use the Document.OpenByUserName
function for catalogs on disk, or the Document.
OpenServerByUserName function for served catalogs
(native or via the SQL service). The catalog is
automatically opened at the maximum access mode
allowed for the specified user.

Portfolio
Visual Basic Guide

Working with Gal eries
Once a catalog has been opened or created, most of
Function GetGalleryIndexFromName(Gallery
the functionality of the Portfolio document model
Name As String) As Integer
is managed through the Gallery object. As noted
elsewhere, there isn’t even a catalog object available.
The following example references the active gallery:
Selecting a Gallery
Example:
PortObj.Gallery(PortObj.GetGalleryIndexFr
The majority of actions in your code will be based
omName(PortObj.GetActive))
upon a reference to a Gallery object. This reference
tells Portfolio not only which catalog’s records are
Sorting a Gallery
to be manipulated, but which set of visible records
(images) are being targeted. Defining which gallery
You can use the sort function of the Gallery
is targeted with your code requires referencing an
object to organize the records in the active
index with the gallery object:
gallery in a particular order. Be sure to only
use indexed, single-valued fields for sorting. To
determine the sort order, set the Direction
PortObj.Gallery(x)
attribute to True to sort in ascending order
To obtain the number of open galleries in the
and False to sort in descending order.
Portfolio document, use the Count property of the
Document object:
Function Sort(FieldName As String,
Direction As Boolean) As Boolean

gCount = PortObj.Count
Example:
To determine the active gallery, use the GetActive
x = PortObj.Gallery(1).
function of the Document object. This returns
Sort(“Filename”,True)
the name of the active gallery. If no gallery is
open when this function is called, a Visual Basic
automation error will occur. See Appendix D for a
full listing of error codes.
sActive = PortObj.GetActive
To read a gallery’s string name, use the
GetGalleryIndexFromName function of the
Document object.

Visual Basic Guide
Creative Assets Management

Saving A Gallery
Adding files to a Gallery
To save an existing gallery that has been changed,
To add source files to a gallery, use the
use the Gallery.Save function for a gallery that
catalog function of the Gallery object.
already exists, or use the Gallery.SaveAs function
The catalog command observes all the
for saving new galleries.
settings found in the Cataloging Options
dialog in the Portfolio application.
Function Save() As Integer
Function Catalog(Path As String,
Function SaveAs(sNewName As String) As
IncludeDirs As Boolean) As Boolean
Integer
Example:
Example:
x = PortObj.Gallery(1).Catalog(“C:\
x = PortGal.Save()
Images\”, True)
x = PortGal.SaveAs(“gallery”)
Any path can be used as the string; this
makes it very simple to catalog folders or
entire volumes, as well as individual files.
To catalog subfolders of a folder or volume,
set the IncludeDirs property to True.

Document Outline
  • ??
  • ??
    • ??
    • ??
    • ??
    • ??
    • ??
    • ??
    • ??
  • ??
    • ??
    • ??
  • ??
    • ??
    • ??
    • ??
  • ??
    • ??
    • ??
  • ??
    • ??
    • ??
    • ??
  • ??
    • ??
    • ??
    • ??
  • ??
  • ??
    • ??
    • ??
    • ??
    • ??
    • ??
    • ??
    • ??
  • ??
    • ??
    • ??
    • ??
  • ??
  • ??