VBScripts in Vertec

Basics Visual Basic Scripts

Note: New scripts should always be written as Python Scripts, not as VBScripts. VBScripts are only available for backward compatibility reasons and are not recommended or completely disabled in the cloud clients for security reasons. See also Point 7 of our 10-Point Plan for a Sustainable Vertec Installation.

Vertec supports the Microsoft Scripting Engine (VBScript) to run custom scripts.

From a Vertec script, the entire Vertec object model can be accessed. This is done in the same way as the access from Word via an (internal) COM / ActiveX extension.

a script can be created either as a Script entry or in a text editor (e.g. Notepad). More information about Vbscript can be found at: Programming with Vbscript or at: VBScript Language Reference on the Microsoft homepage.

Scripts that are used repeatedly can be registered in Vertec. They can then be accessed via the Actions menu item or in the context menu (by right-clicking). See the article about registering scripts.

Objects

The “vertec” object (ivtcsession)

Access to the Vertec object system from a script is always via the global variable vertec. This variable is of the object type IVtcSession and knows the following main methods (only the most important are listed, the full list can be found in the article COM Interfaces):

Characteristics description
eval(expression as string) Evaluates the specified Ocl expression and returns a list of objects.
argobject returns the current object in Vertec.
createobject(class type) creates a new object in Vertec of the specified class type.

The list object (ivtcobjectlist)

In most scripts you will edit a list of objects (e.g. all active projects). The list object is of the object type IVtcObjectList and has the following important methods and properties:

Characteristicsdescription
countreturns the total quantity of objects in the list.
objects(i)returns the ith object. Note: the list starts at 0 and goes up to count-1.

The single object (ivtcobject)

Individual objects are stored in the object type IVtcObject. A single object can be accessed either via vertec.argobject by selecting one from a list of objects (via objects(i)) or as a result of eval(“OCL Expression”).The single object has the following important methods and properties:

Characteristics description
eval(expression as string) Evaluates the specified Ocl expression based on the individual object.
member(name as string)

Returns the content of the member with the specified name. For example, <myprojekt>.member(“code”)</myprojekt> returns the project code.

Members can also be written:member(“membernamen”) = “Your text”.

classname returns the class name of the object, e.g. project or project user.

Otherwise, all features of Vbscript are available to you.

Netherlands

United Kingdom