portfolio 8 visual basic guide

Upload: mpuertz2880

Post on 29-May-2018

226 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    1/28

    Visual BasicGuide

    Creative assets management

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    2/28

    ContactExtensis

    1800 SW First Avenue,Suite 500

    Portland, OR 97201

    Toll Free: (800) 796-9798

    Phone: (503) 274-2020

    Fax: (503) 274-0530

    http://www.extensis.com

    Extensis Europe

    First Floor, Century HouseThe Lakes

    Northampton NN4 7SJ

    United Kingdom

    Phone: +44(0)1604 636 300

    Fax +44 (0)1604 636 366

    [email protected]

    Celartem, Inc.

    Email: [email protected]://www.celartem.com/jp/

    Press Contact

    Phone: (503) 274-2020 x129

    Email: [email protected]

    Customer Service

    Web/email:http://www.extensis.com/customerservice/

    Phone: (800) 796-9798

    Technical Support

    Web/email: http://www.extensis.com/support/

    Documentation Feedback

    Web/email: http://www.extensis.com/helpfeedback/

    2006 Extensis, a division o C elartem, Inc. This document and the

    sotware described in it are copyrighted with all rights reserved. This

    document or the sotware described may not be copied, in whole or part,

    without the written consent o Extensis, except in the normal use o the

    sotware, or to make a backup copy o the sotware. This exception does

    not allow copies to be made or others. Licensed under U.S. patents issued

    and pending.

    Extensis is a registered trademark o Extensis. The Extensis logo, Extensis

    Library, Font Reserve, Font Reserve Server, Font Vault, and Font Sense,

    Portolio, Portolio Server, Portolio NetPublish, NetPublish, Suitcase

    and Suitcase Server are all trademarks o Extensis. Celartem, Celartem,

    Inc., the Celartem logo, PixelLive and PixelSae are trademarks o

    Celartem, Inc. Adobe, Acrobat, Illustrator, Photoshop, and PostScriptare trademarks o Adobe Systems, Incorporated. Apple, AppleScript,

    Bonjour, FontSync, Macintosh, Mac OS 9, Mac OS X, PowerPC,

    and QuickDraw are registered trademarks o Apple Computer, Inc.

    Microsot, Internet Explorer, Windows, Windows XP, Windows 2000,

    Windows NT, Windows ME and Windows 98 are registered trademarks

    o Microsot Corporation. Intel is a registered trademark o Intel.

    All other trademarks are the property o t heir respective owners.

    Portions o this product use sotware components developed through

    various open source projects. The licenses and availability o source

    code or such components are specifed in the copyright notice fle,

    LICENSES.TXT delivered with this product. Please reer to these

    licenses or inormation regarding use o these sotware components.

    Extensis warrants the disks on which the sot ware is recorded to be ree

    rom deects in materials and aulty workmanship under normal use or

    a period o thi rty (30) days rom the original date o purchase. I you

    purchased this product directly rom Extensis, and i a deect occurs

    during the 30-day period, you may return the disks to Extensis or a ree

    replacement. All products submitted or replacement must be registered

    with Extensis beore replacement. Extensis products purchased rom

    resellers are warranted by the reseller and are covered by the resellers

    return policy. This warranty is l imited to replacement and shall not

    encompass any other damages, including but not limited to loss o proft,and special, incidental, or other similar claims. T his sotware is provided

    on an as is basis. Except or the express warranty set orth above,

    Extensis makes no other warranties, either explicit or implied, regarding

    the enclosed sotwares quality, perormance, merchantability, or ftness

    or a particular purpose.

    http://www.extensis.com/http://www.celartem.com/jp/http://www.extensis.com/customerservice/http://www.extensis.com/support/http://www.extensis.com/helpfeedback/http://www.extensis.com/helpfeedback/http://www.extensis.com/support/http://www.extensis.com/customerservice/http://www.celartem.com/jp/http://www.extensis.com/
  • 8/9/2019 Portfolio 8 Visual Basic Guide

    3/28

    iii

    Visual Basic GuidePortfolio

    ContentsVisual Basic and Portolio ......................................................................1

    Introduction to the Portolio Automation Interace ..........................2

    How to add Port olio to your Visual Basic project .................................2

    The Port olio Object Model: ..................................................................2

    Creating Portol io 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

    Sort ing a Gallery ....................................................................................5

    Working with Galleries ..........................................................................5

    Saving A Gallery ....................................................................................6

    Adding fles 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 felds or a catalog ....................................................10

    Changing Field Values .........................................................................10

    Working with Fields .............................................................................10Passing Field Values to Portolio ..........................................................11

    How to Search ....................................................................................12

    Building the Query ..............................................................................12

    Searching the Catalog .........................................................................12

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    4/28

    iv

    Visual Basic Guide Creative Assets Management

    Appendix A: The Portolio Class Libraries ..........................................13

    The Portolio Document Class: ............................................................ 13

    The Port olio Gallery Class: .................................................................. 13

    The Port olio Record Class: .................................................................. 15

    The Portolio Field Class: ..................................................................... 15

    The Portolio Records Class: ................................................................16

    The Portolio Selection Class: .............................................................. 16

    The Portolio AdvancedOptions Class: ................................................16

    APPENDIX B: Frequent Questions and Answers ................................17Port olio Automation Demo: ............................................................... 19

    Path Change Utility: ............................................................................19

    Backup Utility: .....................................................................................19

    APPENDIX C: Guide to The Sample Applications ..............................19

    APPENDIX D: Portolio Programming Error Codes .......................... 20

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    5/28

    Visual Basic GuidePortfolio

    Visual Basic and PortfolioThis document provides a brie overview o the

    Portolio commands available via the Automation

    interace in Extensis Portolio 8.0 or Windows.

    The examples covered here are written in Microsot

    Visual Basic 6. The source code or the sample

    applications is provided in both Visual Basic 6 and

    Visual Basic .NET (2003) ormat. Users amiliar with

    other languages capable o using Automation should

    be able to extrapolate rom the examples or theirparticular languages. This document assumes a basic

    level o working amiliarity with Visual Basic.

    This document is not meant to be an introduction

    to Visual Basic or as a tutorial or how to script

    Portolio to perorm specifc tasks. For more

    inormation about the basics o Visual Basic, please

    visit http://msdn.microsoft.com/vbasic/. This site contains

    a great deal o useul inormation on Visual Basic as

    well as links to other programming-related websites.For more inormation on how to script Extensis

    Portolio, please reer to the additional fles provided

    on the Extensis CD, or with your product download.

    For more inormation about Portolio, please reer

    to the Portolio User Guide installed with your

    Portolio client. For the most up-to-date inormation

    about Portolio, please visit the Extensis website at

    http://www.extensis.com/portfolio/.

    http://msdn.microsoft.com/vbasic/http://www.apple.com/applescript/http://www.apple.com/applescript/http://msdn.microsoft.com/vbasic/
  • 8/9/2019 Portfolio 8 Visual Basic Guide

    6/28

    Visual Basic Guide Creative Assets Management

    How to add Portolio to yourVisual Basic project

    All objects, properties and methods o the Portolio

    interace (as described in the rest o this document)

    are supported in the Portolio_V8 automation

    interace.

    To expose the Portolio object, and its amily o

    classes, to your Visual Basic code, you must frst

    include it in the reerence options in your VB

    project. Use the Project Reerences dialog within

    the VB interace to select the Portolio_V8 library.

    Once this has been done, your VB application will

    be aware o the Portolio document interace and

    you can reerence the amily o classes within your

    VB code.

    The Portolio Object Model:

    The diagram below shows the relative

    structure o the Classes within the

    Portfolio Library Object Model.

    One thing youll notice in the Portolio Object

    Model is that there is no Catalog object or class.

    The Portolio document object is actually a

    collection o Galleries. I you need to reerence the

    Catalog name, you can use the Gallery.Catalog

    name property.

    Introduction to the Portfolio

    Automation Interface

    Portfolio.Document

    Gallery

    AllRecords

    SelectedRecords

    Options

    Fields

    Field

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    7/28

    Visual Basic GuidePortfolio

    Creating Portolio Objects

    As with any application being accessed through

    Automation, you need to create a variable to hold

    the object which reerences the Portolio _

    V8.document class and then create the object using

    the set command

    Example:

    Dim PortObj as Portolio _ V8.document

    Set PortObj = New Portolio _ V8.Document

    I Portolio is already running, the VB application

    will use that instance o the application. Portolio is

    a single-instance application, so there is no way to

    orce a new instance o the application rom within

    VB.

    To access the Gallery class, create an object variable

    to hold a reerence to the Portolio _ V8.Gallery

    class, and then create the reerence using the set

    command.

    Example:

    Dim PortGal as Portolio _ V8.Gallery

    Set PortGal = New Portolio _ V8.Gallery

    Throughout much o this document, the

    examples will reer to objects named PortObj

    and PortGal. These are the objects described

    above, and represent Portolio _ V8.Document

    and Portolio _ V8.Gallery objects. Theseobjects are the communication interaces that

    allow your VB code to access the eatures and

    unctionality o Portolio.

    Opening Catalogs

    To open a Portolio catalog via Automation, use

    the Open unction o the Document object. I the

    catalog has already been opened with this copy o

    Portolio (either through scripting or manually), the

    frst gallery o the catalog will come to the ront and

    become the active gallery.

    Function Open(Path As String, AccessMode

    As Integer, Password As String) As

    Integer

    The acceptable values or AccessMode are as ollows:

    READER = 1

    EDITOR = 2

    PUBLISHER = 3

    ADMINISTRATOR = 4

    Example:

    x = PortObj.Open(C:\test.db,4,)

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    8/28

    Visual Basic Guide Creative Assets Management

    Opening Catalogs on a Server

    To open a catalog which is being served by a

    Portolio Server, use the OpenServer unction o the

    Document object. The command takes the address

    o the catalog in the orm server/catalog, where

    server is the servers name or IP address.

    Function OpenServer(Path As String,

    AccessMode As Integer, Password As

    String) As Integer

    The acceptable values or AccessMode are the

    same as above. Be aware, however, that server

    catalogs cant be opened via your VB code in the

    Administrator mode.

    Example:

    x = PortObj.OpenServer( 192.0.0.0/Test.db,3,)

    Opening catalogs withUser-based access

    To open a catalog with user-based access

    security, use the Document.OpenByUserName

    unction or catalogs on disk, or the Document.

    OpenServerByUserName unction or served catalogs

    (native or via the SQL service). The catalog isautomatically opened at the maximum access mode

    allowed or the specifed user.

    Function OpenByUserName(Path As String,

    UserName As String, Password As String)

    As Integer

    Function OpenServerByUserName(Path As

    String, UserName As String, Password As

    String) As Integer

    Example:

    x = PortObj.OpenByUserName(C:\test.db,User1, password)

    x = PortObj.OpenServerByUserName(192.0.0.0/Test.db,User1,password)

    Creating Catalogs

    To create a new catalog, use the new command. By

    deault, the catalog opens in Administrator mode.

    Function New(Path As String) As Integer

    Example:

    x = PortObj.New(C:\test.db)

    Working with Catalogs

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    9/28

    Visual Basic GuidePortfolio

    Once a catalog has been opened or created, most o

    the unctionality o the Portolio document model

    is managed through the Gallery object. As noted

    elsewhere, there isnt even a catalog object available.

    Selecting a Gallery

    The majority o actions in your code will be based

    upon a reerence to a Gallery object. This reerence

    tells Portolio not only which catalogs records areto be manipulated, but which set o visible records

    (images) are being targeted. Defning which gallery

    is targeted with your code requires reerencing an

    index with the gallery object:

    PortObj.Gallery(x)

    To obtain the number o open galleries in the

    Portolio document, use the Count property o the

    Document object:

    gCount = PortObj.Count

    To determine the active gallery, use the GetActive

    unction o the Document object. This returns

    the name o the active gallery. I no gallery is

    open when this unction is called, a Visual Basic

    automation error will occur. See Appendix D or a

    ull listing o error codes.

    sActive = PortObj.GetActive

    To read a gallerys string name, use the

    GetGalleryIndexFromName unction o the

    Document object.

    Function GetGalleryIndexFromName(Gallery

    Name As String) As Integer

    The ollowing example reerences the active gallery:

    Example:

    PortObj.Gallery(PortObj.GetGalleryIndexFr

    omName(PortObj.GetActive))

    Sorting a GalleryYou can use the sort unction o the Gallery

    object to organize the records in the active

    gallery in a particular order. Be sure to only

    use indexed, single-valued felds or sorting. To

    determine the sort order, set the Direction

    attribute to True to sort in ascending order

    and False to sort in descending order.

    Function Sort(FieldName As String,Direction As Boolean) As Boolean

    Example:

    x = PortObj.Gallery(1).

    Sort(Filename,True)

    Working with Galleries

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    10/28

    Visual Basic Guide Creative Assets Management

    Saving A Gallery

    To save an existing gallery that has been changed,

    use the Gallery.Save unction or a gallery that

    already exists, or use the Gallery.SaveAs unctionor saving new galleries.

    Function Save() As Integer

    Function SaveAs(sNewName As String) As

    Integer

    Example:

    x = PortGal.Save()

    x = PortGal.SaveAs(gallery)

    Adding fles to a Gallery

    To add source fles to a gallery, use the

    catalog unction o the Gallery object.

    The catalog command observes all thesettings ound in the Cataloging Options

    dialog in the Portolio application.

    Function Catalog(Path As String,

    IncludeDirs As Boolean) As Boolean

    Example:

    x = PortObj.Gallery(1).Catalog(C:\

    Images\, True)

    Any path can be used as the string; this

    makes it very simple to catalog olders or

    entire volumes, as well as individual fles.

    To catalog subolders o a older or volume,

    set the IncludeDirs property to True.

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    11/28

    Visual Basic GuidePortfolio

    How to access the Advanced Options

    Cataloging options can also be controlled within

    your Visual Basic application using the Portolio

    Automation interace. These are accessed via the

    AdvancedOptions class o the Portolio object.

    The AdvancedOptions object contains properties

    that correspond to the controls available in the

    Cataloging Options and Advanced Options dialog

    boxes. These are ound in the Portolio interace inthe Catalog menu.

    Catalog Property Listing

    The available properties o the class are:

    AppendDescription

    ExtractMetaData

    ExtractThumbnail

    SkipFiles

    MergeKeywords

    ParseKeywords

    PathKeywords

    0 - None

    1 - File Name

    2 - File and Folder Name

    3 - Path Name

    4 - Path Name and Volume

    ThumbnailSize

    0 - 112 x 112

    1 - 256 x 256

    The ollowing example instructs Portolio to attempt

    to extract an embedded thumbnail rom a source

    fle the next time a fle is cataloged in the gallery.

    Example:

    PortObj.Gallery(1).AdvancedOptions.

    ExtractThumbnail = True

    Cataloging - Advanced Options

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    12/28

    Visual Basic Guide Creative Assets Management

    Accessing Individual Records

    Each gallery typically contains one or more record

    objects. I, however, it is a new gallery, it may

    contain no records. Use the records properties o

    the gallery class to iterate through a set o records

    to manipulate the values o the felds within each

    record. Records are typically reerenced through the

    AllRecords object. This object contains a record

    object or each record in the selected gallery. Beaware that an index represents the current order o

    records within a particular gallery, so a particular

    records index will change based on the contents

    and order o the gallery.

    To access a particular record in a catalog, pass in the

    index number or the desired record object into the

    AllRecords object.

    PortObj.Gallery(1).AllRecords(x)

    To get the count o all the records in a gallery, use

    the Count property.

    rCount = PortObj.Gallery(1).AllRecords.

    Count

    Be aware that this returns the number o recordsin the gallery, which is not necessarily the same

    as the number o records in the entire catalog.

    Working with Selections

    One common use o scripts (or Visual Basic

    programs) is to perorm operations based on the

    selection o records the user has made in the

    catalog. To determine which records are currently

    selected, simply reer to the SelectedRecords

    object within a particular Gallery object. As

    with theAllRecords object, an index is used

    to identiy a particular record object within theSelectedRecords object.

    Example:

    PortObj.Gallery(1).SelectedRecords(x)

    As with theAllRecords object, SelectedRecords

    also has a count property that will return

    the numbers o individual records selected.

    This can then be used to defne a loop in

    your Visual Basic code and step throughall the selected records in the gallery.

    Working with Records & Selections

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    13/28

    Visual Basic GuidePortfolio

    Selecting items

    To modiy the selection, use the select and deselect

    unctions. The select unction does not deselect the

    current selection, so it may be necessary to use thedeselect unction frst to clear the selection.

    Examples:

    PortObj.Gallery(1).AllRecords(1).Select

    PortObj.Gallery(1).SelectedRecords(2).

    Deselect

    In addition, the Gallery object has a SelectAll

    unction, which will set the selection point toinclude every record in the gallery.

    Example:

    PortObj.Gallery(1).SelectAll

    Changes to the selection may not be visibleon screen until the gallery is rereshed.The selection will be accurate, but thescreen may not redraw i the items being

    manipulated are already visible.

    List view does not support modiying theselection. TheSelectedRecords object isaccessible, but theSelect andDeselectunctions will not work.

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    14/28

    0

    Visual Basic Guide Creative Assets Management

    Each Record object contains a number o Field

    objects (one or each system feld and one or each

    custom feld). A particular feld is identifed by

    passing in the felds name.

    PortObj.Gallery(1).AllRecords(1).Field(x)

    To determine a value or a feld, use the Field

    objects Value property.

    SDesc = PortObj.Gallery(1).AllRecords(1).

    Field(Description).Value

    To determine the number o felds in a catalog, get

    the Count property o a particular record.

    dCount = PortGal.AllRecords(1).Count

    Determining the felds or a catalog

    Portolios dynamic data structure allows the userto customize the catalog by defning custom felds.

    Since you might be working with a record structure

    that contains custom data felds, it is oten useul to

    determine which felds are defned in a particular

    catalog. To do this, step through the list o all the

    feld names or a particular record (any record

    within a catalog will return the same results) and

    examine the Name property.

    Example:

    dCount = PortGal.AllRecords(1).Count

    For i = 1 To dCount

    I PortObj.Gallery(1).AllRecords(1).

    Fields(i).Name = FieldName Then

    rem Found the feld titled FieldName

    End I

    Next

    Changing Field Values

    One o the most powerul aspects o the Portolio

    scripting interace is the ability to not only read all

    o the felds in a record, but also to modiy all o thefelds (including the system felds). Be aware that

    while this is a very useul tool, it is also possible to

    ruin a catalog by incorrectly modiying data that

    Portolio uses to manage source fles. For example,

    incorrectly modiying the path o each record in a

    catalog could result in Portolio being unable to fnd

    any records again. Setting the feld value is done in

    the same manner as getting the feld values.

    Example:

    PortObj.Gallery(1).AllRecords(1).

    Field(Description).Value = This is the

    new description

    You can also fnd an example o Visual Basic code

    that perorms a search and replay unction on felds

    in the Portolio tables in the Path Change utility

    application that accompanies this document.

    Proceed with caution when you are learningto manipulate the content o felds within thePortol io data tables. It is possible to make datachanges that could corrupt your entire catalog.Always back up your Portolio data beore tryingto make changes to the data within the tablesrom within your Visual Basic code.

    Working with Fields

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    15/28

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    16/28

    Visual Basic Guide Creative Assets Management

    How to Search

    To perorm a search in a Portolio catalog, use the

    fnd unction o the Gallery object. Searches in

    Portolio are executed by passing in a text string

    which represents the search criteria. The ormat o

    the search string should ollow the ormat used in

    the Find dialog in Portolio. The basic unctionality

    is shown below. See the next section or how to

    ormulate the query variable properly.

    Function Find(SearchString As String,

    AllRecords As Boolean, SetNewGallery As

    Boolean) As Integer

    TheAllRecords attribute is the equivalent

    o the Find in Gallery option o the Portolio

    Find dialog box. A value oTrue is the

    equivalent o that box being unchecked. The

    SetNewGallery attribute is the equivalent othe Display Results in New Gallery option in

    the Portolio Find dialog box. A value oTrue

    is the equivalent o that box being checked.

    To fnd all the records in the catalog, simply pass in

    a query that cannot ail.

    Example:

    PortObj.Gallery(1).Find((Filename &vbTab & starts with & vbTab & ),

    True, False)

    Building the Query

    Searches in Portolio are executed by passing a text

    string to the Document object which represents

    the search criteria. The structure o this query

    inormation is the same as it is presented in the

    Find dialog box within Portolio. As in the Portolio

    Find dialog box, the basic query structure consists

    o three clauses: the feld, the operator, and the

    value. Each o these clauses is passed in as a textstring, and the tab character separates each clause.

    Example:

    theQuery = Keywords & vbTab & starts

    with & vbTab & test

    PortObj.Gallery(1).Find(theQuery, True,

    False)

    To build a more complex search, a return charactermust be used to delimit each line. In addition,

    each line ater the frst one needs to begin with the

    join condition (either and or or). Below is an

    example o a two line search query:

    Example:

    theQuery = Filename & vbTab & starts

    with & vbTab & test & vbNewLine &

    and & vbTab & Keywords & vbTab &

    starts with & vbTab & key

    Searching the Catalog

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    17/28

    Visual Basic GuidePortfolio

    This appendix contains an alphabetical listing o

    all o the members, unctions and properties o

    each o the Portolio classes exposed through the

    automation model.

    The Portolio Document Class:

    Count as Long

    Gallery(nIndex as Long) as Object [read-

    only]

    GetActive() as String

    GetGalleryIndexFromName(GalleryName as

    String) as Integer

    LastError as Long

    New(Path as String) as Integer

    NewCatalogWithPrompt() as Integer

    Open(Path As String, AccessMode As

    Integer, Password As String) As Integer

    OpenByUserName(Path As String,

    AccessMode As Integer, UserName As

    String, Password As String) As Integer

    OpenServer(sAddress As String,

    AccessMode As Integer, Password As

    String) As Integer

    OpenServerByUserName(sAddress As String,

    AccessMode As Integer, UserName As

    String, Password As String) As Integer

    OpenServerWithPrompt(sAddress As String)

    As Integer

    OpenWithPrompt(sPath As String) As

    Integer

    SetActive(GalleryName As String) As

    Integer

    Visible as Boolean

    The Portolio Gallery Class:

    Function Activate() As Integer

    Function AddFiles(pDataObj As Unknown)

    As Boolean

    Function AddRecord(szFile As String,

    szJPEGThumbnailFile As String,

    nThumbSize As Integer, nThumbQuality As

    Integer) As Object

    AllRecords As Object

    Busy as Long

    Function Catalog(Path As String,

    IncludeDirs As Boolean, bUseUserSettings

    As Long) As Boolean

    Appendix A:The Portfolio Class Libraries

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    18/28

    Visual Basic Guide Creative Assets Management

    CatalogName as String

    Function CatalogUsingOptionsPreset(Pa

    th As String, szPresetName As String,IncludeDirs As Boolean) As Boolean

    Function Close() As Integer

    Function CollectFiles(szFileCollec

    tFolder As String, bKeepHierarchy

    As Boolean, bCollectOriginals As

    Boolean, nPreviewSizeInPixels As

    Integer, bOrigINoPreview As Boolean,

    bCreateArchiveCatalog As Boolean,szCatalogPath As String, szVolumeName

    As String, bOverwriteExistingCatalog

    As Boolean, bIncludeBrowser As Boolean,

    bIncludeUserGuide As Boolean) As Integer

    Count as Long

    Function CreateCustomField(szFieldNa

    me As String, nFieldType As Integer,

    bMultiValued As Boolean, nFieldOption AsInteger, szAdminPassword As String) As

    Boolean

    Function CreateCustomFieldPreDe(sz

    FieldName As String, nFieldType As

    Integer, bMultiValued As Boolean,

    nFieldOption As Integer, bFromListOnly

    As Boolean, szFieldValueList As String,

    szAdminPassword As String) As Boolean

    Function CreatePlaceholder(szFileName

    As String, szOptionalPath As String) As

    Long

    Function DeleteRecord(RID As Long,

    bDeleteFromCatalog As Boolean) As

    Boolean

    Function Find(SearchString As String,

    AllRecords As Boolean, SetNewGallery As

    Boolean) As Integer

    GalleryName as String

    Function GetRecordFromRecordID(nRecordID

    As Long) As Object

    Function ImportFieldValues(Path As

    String, SavedSet As String) As Boolean

    NumFound as Long

    Options as Object

    Sub RereshView()

    Function Save() As Integer

    Function SaveAs(sNewName As String) As

    Integer

    Function SelectAll() As Integer

    SelectedRecords As Object

    Function Sort(FieldName As String,

    Direction As Boolean) As Boolean

    TotalRecordsInCatalog As Long

    Vi l B i G id

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    19/28

    Visual Basic GuidePortfolio

    The Portolio Record Class:

    Count as Long

    Function Delete(bDeleteFromCatalog As

    Boolean) As Boolean

    Deselect() as Boolean

    Sub EnsureVisible()

    Function ExtractProperties() as Boolean

    Property Field(FieldName as String) as

    Object

    Property Fields(nIndex as Long) as

    Object

    Function GetThumbnailData(pData, nSize

    As Long) As Boolean

    IsSelected as Boolean

    RecordID as Long

    Function RegenerateThumbnail() As

    Integer

    Function Select() As Boolean

    Function Update() As Boolean

    The Portolio Field Class:

    DeleteData() as Boolean

    DeleteMVData(Value As String) As Boolean

    GetMVData(nIndex As Long) As String

    GetPredefnedValue(Index As Integer) As

    String

    GetPredefnedValueCount() As Integer

    GetPredefnedValueList() as String

    IsCustom as Boolean

    IsIndexed as Boolean

    IsMultiValue as Boolean

    IsPredefned as Boolean

    IsURL as Boolean

    MyDataCount as Long

    Name as String

    Type as Integer

    Value as String

    Visual Basic Guide

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    20/28

    Visual Basic Guide Creative Assets Management

    The Portolio Records Class:

    Count as Long

    Function GalleryCopy(nGalleryIndex as

    Long)as Integer

    Property Records(nIndex as Long) as

    Object [read-only]

    The Portolio Selection Class:

    Count as Long

    Function GalleryCopy(nGalleryIndex asLong) as Integer

    Property Records(nIndex as Long) As

    Object [read-only]

    The Portolio AdvancedOptions Class:

    AppendDescription as Integer

    ExtractMetadata as Boolean

    ExtractThumbnail as Boolean

    MergeKeywords as Integer

    ParseKeywords as Integer

    PathKeywords as Integer

    SkipFiles as Boolean

    ThumbnailSize as Integer

    Visual Basic GuidePortfolio

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    21/28

    Visual Basic GuidePortfolio

    This appendix contains some o the most requently

    asked questions about VB programming with the

    Portolio document object.

    How do I add the Portolio reerencesto my Visual Basic Project?

    From the Project menu, select the reerences option.

    Find the Portolio_V8 library reerence, select it and

    click the OK button. The Portolio document object

    will now be included in your VB source project and

    its objects and properties exposed or use in your VB

    code. See the beginning o the tutorial or examples

    o the code required to declare and set a Portolio

    document object within your project.

    Can I use VBA or VB Script with Portolio, or doI have to use the ull version o Visual Basic?

    There are major dierences in the way objects are

    defned and handled in the ull version o Visual

    Basic and in VBA and VB Scripting. Due to these

    dierences, Portolio only supports the use o the

    ull version o Visual Basic or Visual Basic.net.

    What is the PortObj variable you keep reerencing?

    In all o the sample code, and this document, weve

    used the PortObj variable name to identiy the

    Portolio document object being reerenced in the

    code. You are ree to use any variable name you

    choose in your own code, but or purposes o clarity,

    we use the standard object name throughout the

    documentation and sample code.

    Can I use the Portolio automation library with VB.Net?

    The automation object model use by Portolio will

    work with VB.net, but you need to keep in mind that

    i you develop any applications using the Portolio

    automation object in VB.net, the Net Framework

    will have to be installed on any machine that will be

    running your application.

    Where can I fnd the feld defnitionsor the Portolio tables?

    While in Portolio, use the Customize View option

    to see a ull listing o felds included in a Catalog.

    You can use this to select which felds you wish to

    see displayed. Use this as a debugging tool when

    you are writing code to edit or change feld values. It

    provides instant eedback to see i you code executedthe changes you expected in the feld values.

    I you wish to read or display the list o available

    felds rom within your Visual Basic application, see

    the Working with Fields section o the tutorial.

    APPENDIX B:Frequent Questions and Answers

    Visual Basic Guide Creative Assets Management

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    22/28

    Visual Basic Guide Creative Assets Management

    How can I tell how many Galleries are open?

    You can get a count o the current open Galleries

    with the ollowing code:

    PortObj.Document.Count

    You need to be aware that this Count value will

    return the number o all Galleries that are currently

    open in all open Catalogs. For example, i you have

    two open Catalogs, with three Galleries each, and

    one Gallery is open in each Catalog, the Count value

    you receive will be two.

    Can I activate a particular Gallery rom my VB code?

    Yes. Use the ollowing command:

    PortObj.SetActive(CatalogName.db -

    GalleryName)

    Be aware that you must use the ull Gallery name,

    including the parent catalog. You cant just use

    the name o the Gallery itsel. You can fnd the ull

    Gallery name by looking at the Gallery windowscaption bar in Portolio.

    How can I get the Catalog name?

    As youve probably noticed, with no Catalog class

    or object there isnt an obvious way to read theCatalog name. Remember that the document object

    is actually a collection o Galleries, and a Gallery

    object has a Catalog Name property. You can use

    this to read the name o the current catalog:

    NameVariable = PortGal.CatalogName

    You can also reerence the Catalog name by looking

    at the Gallery.Name property which will include the

    Catalog name as part o the Gallery name defnition.

    For example:

    Gallery Name: (MasterCatalog.db -

    Sample Gallery)

    Why do I keep getting errors whentrying to set feld values?

    See the section on Passing Field Values to Portfolio

    in the tutorial. The most common cause o this errorwill be that you are passing non-string values to the

    Portolio object. It expects all feld values, regardless

    o the type, to be passed as string values.

    Visual Basic GuidePortfolio

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    23/28

    Visual Basic GuidePortfolio

    Portolio Automation Demo:

    While this application provides a variety o utility

    unctions, its greatest value to the VB programmer

    lies in the wide range o Portolio class objects and

    methods it uses. By stepping through the code as it

    runs, you can ollow many o the key programmingunctions available to you as you learn to program

    using the Portolio document object and its classes.

    Path Change Utility:

    This is a helpul utility that will let you edit the

    path defnitions within the Portolio database i

    you have moved cataloged images rom one

    location to another.

    You should be aware that there are two felds that

    hold the path inormation or a record (Path and

    Directory Path) and i you wish to redefne the

    path ino or a record you must change both o

    these felds.

    You can also examine the code to fnd an example

    o how to read and write feld values rom within

    your VB code.

    Backup Utility:

    This is a simple utility program that will let you back

    up an existing Portolio catalog. While it doesnt

    use any o the Portolio automation methods, it

    does provide an example o how to stop and start

    the Portolio server rom within your VB code usingpredefned .BAT fles.

    APPENDIX C:Guide to The Sample Applications

    Visual Basic Guide Creative Assets Management

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    24/28

    0

    Visual Basic Guide Creative Assets Management

    This appendix contains an alphabetical listing o all

    o the members o each Portolio class object.

    When an error occurs, the Portolio error code

    value can be ound by reading the ObjectName.

    LastError property. Any time a unction or call

    succeeds that error value is set to zero.

    Use standard Visual Basic error-trapping procedures

    to test and handle these errors. (See your VB

    reerence books i you arent sure how to manage

    error handling within your VB application.)

    KScriptNoError 0 No Error (Success)

    KScriptBadPassword 1 Incorrect/Invalid Password

    KScriptCatInUse 2 Catalog is currently in use and thereore cannot beopened in this mode. This error code is not actually used in thePortolio client code and thereore should not be encountered.

    KScriptAdminCatInUse 3 Attempting to open a Catalog in Adminmode whilst there are other users

    KScriptAdminInUse 4 Someone else is already logged in as Admin

    KScriptReadOnlyAvailable 5 Catalog is only available in read-only mode,or example on a read-only volume

    KScriptServedAdminError 6 Opening a served Catalog in Admin (or Browser) mode

    KScriptUnknownCatError 7 Unknown error trying to open Catalog

    KScriptInvalidMode 8 Invalid mode

    KScriptNoFileName 9 No Filename

    KScriptDiskFull 10 Disk ull

    KScriptErrorCreate 11 Error creating Catalog

    kScriptInvalidFieldname 12 Invalid Field name

    kScriptFieldNotIndex 13 Field isnt indexed

    kScriptFieldNotMultiVal 14 Field isnt multivalue

    kScriptIndexOutORange 15 Index out o range

    APPENDIX D:Portfolio Programming Error Codes

    Visual Basic GuidePortfolio

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    25/28

    kScriptEmptyValue 16 Empty value

    kScriptInvalidValueorFieldType 17 Value is invalid or given Field type

    kScriptValueNotInPredeList 18 Value is not in pre-defned list

    kScriptCatalogNotFound 19 Catalog could not be ound

    kScriptServerNotFound 20 Server could not be ound

    kScriptMaxServerConnected 21 Maximum allowed number server connections reached

    kScriptInvalidFieldValue1 22 Invalid FieldValue Field 1

    kScriptInvalidFieldValue2 23 Invalid FieldValue Field 2

    kScriptInvalidGallery 24 Invalid Gallery

    kScriptInvalidQuery 25 Invalid Query (Find) specifcation

    kScriptSystemField 26 Cant change system (built-in) Field

    kScriptGalleryNotFound 27 Gallery Not Found

    kScriptFieldNotPredefned 28 Field Not o pre-defned Type

    kScriptInvalidCatalogOption 29 Invalid Cataloging option

    kScriptInvalidHTMLSetName 30 Invalid HTML saved set name

    kScriptCreatingHTMLImagesDir 31 Error Creating HTML Images Directory

    kScriptCreatingHTMLFile 32 Error Creating HTML File

    kScriptWritingHTMLFile 33 Error writing to HTML fle

    kScriptOutOMemory 34 Out o memory

    kScriptCopyError 35 Copy error (GalleryCopy)

    kScriptServerDisconnect 36 Server disconnected

    kScriptInvalidForFoundItems 37 Cant perorm on ound items gallery

    kScriptInvalidLoginMode 38 Attempting to open user-based catalog with level-based API

    kScriptUnknownError 1000 Unknown Error opening/creating catalog

    Visual Basic Guide Creative Assets Management

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    26/28

    g

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    27/28

  • 8/9/2019 Portfolio 8 Visual Basic Guide

    28/28

    P8_VBG_0506