×

Projects

A Project represents the main contents of an OmniPlan Document and is used as the global object in any scripting session that is related to a particular document.

Instance Properties

Here are the instance properties of the Project class:

A Project represents the contents of an OmniPlan document, and when writing scripts that target the content of the current document, the project becomes the topmost object, providing properties whose values are references to the scenarios (actual and baselines) the project contains.

In the following example, all three syntax variations are valid, but in practice, the sole property name “actual” is commonly used to represent the current instance of the Scenario class:

The “actual” Property


document.project.actual //--> [object Scenario] // The Project is the topmost object and can be referenced using the “this” keyword this.actual 06//--> [object Scenario] // Since the Project is the top-level item, it is implied and so you can simply use the property name actual //--> [object Scenario]

The same applies to the “title” property as well:

The “title” Property


document.project.title //--> "90-Day Blank Project" // The Project is the topmost object and can be referenced using the “this” keyword this.title //--> "90-Day Blank Project" // Since the Project is the top-level item, it is implied and so you can simply use the property name title //--> "90-Day Blank Project"

Instance Functions

Here are the functions that can be called on an instance of the Project class:

As with project properties, the use of project functions may assume the top-level status of the Project class, and be entered without preface:

Target a Baseline


var targetScenario = baselineNamed("Alternate Baseline") if(targetScenario){ // processing statements go here }

Instances of the Project, Resource, and Task classes may optionally have metadata keys and values associated with them. Use the following functions to set and retrieve the metadata:

Set and Retrieve Project Metadata


setCustomValue("Manager", "Wanda Gardener") customValue("Manager") //--> "Wanda Gardener" setCustomValue("Contact", "w.gardener@acme.com") customValue("Contact") //--> "w.gardener@acme.com"

Metadata for the project can be viewed and edited in the project inspector pane:

project-metadata