Chapter 9 Accessing objects using VBScript


Creating a shortcut using VBScript

When you create an internal shortcut of an object you add the existing object in a different package within the same model. The shortcut is created in the package specified in first parameter.

You use the following method: CreateShortcut(ByVal NewPackage As BaseObject, ByVal ParentCol As String = "") As BaseObject.

Example

Set Model = CreateModel (PDCDM.cls_Model)
Set Package = Model.Packages.CreateNew
Set Entity = Model.Entities.CreateNew
Set Shortcut = Entity.CreateShortcut (Package)

When you create an external shortcut of an object you add the existing object in a package located in a different model.

Example

  ' this script creates a shortcut of MyFile in Model2
Set Model1 = CreateModel (PDCDM.cls_Model)
Set MyFile = Model1.Files.CreateNew
Set Model2 = CreateModel(PDCDM.cls_Model)
Set Shortcut = MyFile.CreateShortcut (Model2)

You can also create an external shortcut of an object by adding the object in a collection that is not owned by the model.

Example

  ' this script creates a shortcut of MyFile in Model2
Set Model1 = CreateModel (PDCDM.cls_Model)
Set MyFile = Model1.Files.CreateNew
Set Model2 = CreateModel(PDCDM.cls_Model)
Model2.Files.Add(MyFile)

 


Copyright (C) 2005. Sybase Inc. All rights reserved.