OmniPlan Classes
(v4.2.4)Alert • Application • Array • Assignment • Calendar • CalendarEvent • Color • ColorSpace • Console • Credentials • Data • DateComponents • Decimal • Dependency • DependencyKind • Device • DeviceType • Document • PlanDocument • Duration • Email • Error • FilePicker • FileSaver • FileWrapper • FileWrapper.Type • Form • Form.Field • Form.Field.Checkbox • Form.Field.Date • Form.Field.MultipleOptions • Form.Field.Option • Form.Field.Password • Form.Field.String • Formatter • Formatter.Date • Formatter.Decimal • Formatter.Duration • Formatter.Date.Style • Function • Image • Locale • MenuItem • Pasteboard • Pasteboard.Item • PlugIn • PlugIn.Action • PlugIn.Handler • PlugIn.Handler.Registration • PlugIn.Library • Project • Promise • Resource • ResourceAssignmentType • ResourceCalendar • ResourceType • Scenario • Schedule • Selection • SharePanel • Task • TaskType • TimeZone • Timer • ToolbarItem • TypeIdentifier • URL • URL.FetchRequest • URL.FetchResponse • Version • Window
Alert
An alert interface for displaying information to the user, blocking further interaction until the alert is dismissed.
new Alert(title: String
, message: String
)
→ Alert
Create a new alert panel with the given title and text contents.
function show(callback: Function
or null
) → Promise
of Number
Displays the alert. If no options have yet been added, a default “OK” option is added. Once the user selects an option, the alert is dismissed. If a callback function was supplied, it is invoked with the zero-based index of the selected option as its argument. A Promise
is returned as well, which may also be used to collect the result of the Alert
.
function addOption(string: String
)
Adds an option button to the alert.
Application
function openDocument(from: Document
or null
, url: URL
, completed: Function
)
Attempts to open the specified document and return a reference to it asynchronously. If the document is already open, the reference is passed along. Note that due to platform sandboxing restrictions, opening the document may fail if the application doesn’t have currently permission to access the given URL
. The document, if any, that is associated with the calling script can be passed along to help grant permission to open the new document.
The passed in function will be passed two argument. The first will be either either the Document
or an Error
. On success, the second argument is a Boolean
specifying whether the document was already open.
var buildVersion
→ Version
read-onlyThe internal build version number for the app. See also userVersion
.
var commandKeyDown
→ Boolean
read-onlyWhether the Command key is currently down. (Currently only available on Mac.)
var controlKeyDown
→ Boolean
read-onlyWhether the Control key is currently down. (Currently only available on Mac.)
var name
→ String
read-onlyApplication name.
var optionKeyDown
→ Boolean
read-onlyWhether the Option key is currently down. (Currently only available on Mac.)
var platformName
→ String
read-onlyReturns a string describing the current platform, currently "iOS"
or "macOS"
.
var shiftKeyDown
→ Boolean
read-onlyWhether the Shift key is currently down. (Currently only available on Mac.)
var userVersion
→ Version
read-onlyThe user-visible version number for the app. See also buildVersion
.
var version
→ String
read-onlyDeprecated: Recommend using either userVersion
or buildVersion
.
For backwards compatibility with existing scripts, this returns the same result as buildVersion.versionString
. We recommend using either the user-visible userVersion
or the internal buildVersion
instead, which are more clear about which version they’re returning and provide their results as Version
objects which can be semantically compared with other Version
objects.
Array
The built-in JavaScript Array
constructor.
Assignment
An Assignment
from a Resource
to a Task
.
function remove()
Call to delete this assignment, removing it from it’s task and resource.
var isLocal
→ Boolean
read-onlyWhether this assignment is part of this project or not. A non-local assignment comes from sharing resource loads from a server project repository.
var resource
→ Resource
read-onlyThe Resource
of this assignment.
var specificAssignments
→ Array
of Assignment
read-onlyWhen the assigned resource is to a resource group, the specific resources within that group who are actually assigned to do the work.
var task
→ Task
read-onlyThe Task
of this assignment.
var totalCost
→ Decimal
read-onlyTotal cost of this assignment.
var totalDuration
→ Number
read-onlyTotal duration of this assignment.
var totalEffort
→ Number
read-onlyTotal effort performed during this assignment.
var unitsAssigned
→ Number
Resource units assigned to this task.
Calendar
var buddhist
→ Calendar
read-onlyvar chinese
→ Calendar
read-onlyvar coptic
→ Calendar
read-onlyvar current
→ Calendar
read-onlyThe user’s preferred calendar
var ethiopicAmeteAlem
→ Calendar
read-onlyvar ethiopicAmeteMihret
→ Calendar
read-onlyvar gregorian
→ Calendar
read-onlyThe Gregorian calendar.
var hebrew
→ Calendar
read-onlyvar indian
→ Calendar
read-onlyvar islamic
→ Calendar
read-onlyvar islamicCivil
→ Calendar
read-onlyvar islamicTabular
→ Calendar
read-onlyvar islamicUmmAlQura
→ Calendar
read-onlyvar iso8601
→ Calendar
read-onlyvar japanese
→ Calendar
read-onlyvar persian
→ Calendar
read-onlyvar republicOfChina
→ Calendar
read-onlyfunction dateByAddingDateComponents(date: Date
, components: DateComponents
) → Date
or null
Returns a new Date
by adding the given DateComponents
, or null if no date could be calculated.
function dateFromDateComponents(components: DateComponents
) → Date
or null
Returns a new Date
from the given DateComponents
, or null if no date could be calculated.
function dateComponentsFromDate(date: Date
)
→ DateComponents
Returns a new DateComponents
for the given Date
.
function dateComponentsBetweenDates(start: Date
, end: Date
)
→ DateComponents
Returns the difference from the start Date
to the end Date
as a DateComponents
.
function startOfDay(date: Date
)
→ Date
Returns a Date
for the first moment of the day containing the given Date
according to this Calendar
.
var identifier
→ String
read-onlyThe ISO identifier for the calendar.
var locale
→ Locale
or null
read-onlyThe locale of the calendar.
var timeZone
→ TimeZone
read-onlyThe time zone of the calendar.
CalendarEvent
var end
→ Date
read-onlyEnding date for this event.
var start
→ Date
read-onlyStarting date for this event.
var title
→ String
or null
read-onlyTitle of this event.
Color
function RGB(r: Number
, g: Number
, b: Number
, a: Number
or null
)
→ Color
Makes a new color in the RGB
colorspace, with the given components. If the alpha component is not given, 1.0 is used.
function HSB(h: Number
, s: Number
, b: Number
, a: Number
or null
)
→ Color
Makes a new color in the HSB
colorspace, with the given components. If the alpha component is not given, 1.0 is used.
function White(w: Number
, a: Number
or null
)
→ Color
Makes a new color in the White
colorspace, with the given components. If the alpha component is not given, 1.0 is used.
var black
→ Color
read-onlyA color in the White
colorspace with white component of 0.0.
var blue
→ Color
read-onlyA color in the RGB
colorspace with components (0, 0, 1, 1).
var brown
→ Color
read-onlyA color in the RGB
colorspace with components (0.6, 0.4, 0.2, 1).
var clear
→ Color
read-onlyA color in the White
colorspace with white component of 0.0 and alpha of 0.0 (“transparent black”).
var cyan
→ Color
read-onlyA color in the RGB
colorspace with components (0, 1, 1, 1).
var darkGray
→ Color
read-onlyA color in the White
colorspace with white component of 0.333.
var gray
→ Color
read-onlyA color in the White
colorspace with white component of 0.5.
var green
→ Color
read-onlyA color in the RGB
colorspace with components (0, 1, 0, 1).
var lightGray
→ Color
read-onlyA color in the White
colorspace with white component of 0.667.
var magenta
→ Color
read-onlyA color in the RGB
colorspace with components (1, 0, 1, 1).
var orange
→ Color
read-onlyA color in the RGB
colorspace with components (1, 0.5, 0, 1).
var purple
→ Color
read-onlyA color in the RGB
colorspace with components (1, 0, 1, 1).
var red
→ Color
read-onlyA color in the RGB
colorspace with components (1, 0, 0, 1).
var white
→ Color
read-onlyA color in the White
colorspace with white component of 1.0.
var yellow
→ Color
read-onlyA color in the RGB
colorspace with components (1, 1, 0, 1).
function blend(otherColor: Color
, fraction: Number
) → Color
or null
Returns a new color that is a linear combination of the receiver and fraction
of the other color (so, a fraction of 1.0 would just return the otherColor
. If the colors cannot be blended (for example, if they cannot be converted to the same colorspace), then null
is returned.
var alpha
→ Number
read-onlyReturns the alpha component of the color.
var blue
→ Number
read-onlyReturns the blue component of the color, after converting to a RGB
colorspace.
var brightness
→ Number
read-onlyReturns the brightness component of the color, after converting to a HSB
colorspace.
var colorSpace
→ ColorSpace
read-onlyReturns the colorspace of the instance.
var green
→ Number
read-onlyReturns the green component of the color, after converting to a RGB
colorspace.
var hue
→ Number
read-onlyReturns the hue component of the color, after converting to a HSB
colorspace.
var red
→ Number
read-onlyReturns the red component of the color, after converting to a RGB
colorspace.
var saturation
→ Number
read-onlyReturns the saturation component of the color, after converting to a HSB
colorspace.
var white
→ Number
read-onlyReturns the white component of the color, after converting to a White
colorspace.
ColorSpace
var CMYK
→ ColorSpace
read-onlyA colorspace with cyan, magenta, yellow, black, and alpha components.
var HSB
→ ColorSpace
read-onlyA colorspace with hue, saturation, and value (or brightness) components.
var Named
→ ColorSpace
read-onlyA space for named colors, like system defined colors, or specific color palette spaces.
var Pattern
→ ColorSpace
read-onlyA colorspace that wraps a pattern image.
var RGB
→ ColorSpace
read-onlyThe sRGB colorspace with red, green, blue, and alpha components.
var White
→ ColorSpace
read-onlyA colorspace with white and alpha components.
var all
→ Array
of ColorSpace
read-onlyAn array of all items of this enumeration.
Console
The Console
allows scripts to log debugging, warning, or error information where it can be viewed in the system console or in the console output area. A single instance of Console
is available to scripts as the console
global variable.
function log(message: Object
, additional: Array
of Object
or null
)Appends a line to the application console formed by concatenating the given message
(after converting it to a String
), any additional arguments separated by spaces, and finally a newline.
function error(message: Object
, additional: Array
of Object
or null
)function info(message: Object
, additional: Array
of Object
or null
)function warn(message: Object
, additional: Array
of Object
or null
)Just calls Console.log
, currently.
function clear()
Clears the console in the user-visible window.
Credentials
The Credentials
class allows storage of private username and password pairs. Instances are tied to a single plug-in and single application, and may only be created in plug-ins when they are being loaded.
For example, when a PlugIn.Action
is being created, you could use the following pattern:
(() => {
let credentials = new Credentials();
var action = new PlugIn.Action(function(selection) {
// ... use the captured credentials ...
});
return action;
})();
Attempts to create Credential
instances elsewhere will throw an error. Care should be taken to store instances in anonymous closures as above, and not pass them to or store them on other objects.
Credentials are keyed off a service identifier, which your plug-in can define however it likes.
new Credentials()
→ Credentials
Creates a new Credentials
instance for the currently loading plug-in. Throws an error if called outside of plug-in loading.
function read(service: String
)
→ Object or null
Looks up the current credentials for a given service identifier. If credentials have previously been stored, an object will be returned containing "user"
an "password"
properties.
function write(service: String
, username: String
, password: String
)
Creates or updates an existing credential, storing the username and password for this service securely in the Keychain.
function remove(service: String
)
Deletes any currently stored credentials for the specified service
Data
A generic bag of bytes. Mainly useful to be interpreted / converted to some other type.
function fromString(string: String
)
→ Data
Convert from a String
to the UTF8 encoding of that string as Data
function fromBase64(string: String
)
→ Data
function toString()
→ String
Convert to a String
, assuming that this Data
is encoded as UTF8.
function toBase64()
→ String
Convert to a Base-64 encoded string.
var length
→ Number
read-onlyNumber of bytes in this data.
var toObject
→ Object
or null
read-onlyDateComponents
new DateComponents()
→ DateComponents
var date
→ Date
or null
read-onlyvar day
→ Number
or null
var era
→ Number
or null
var hour
→ Number
or null
var minute
→ Number
or null
var month
→ Number
or null
var nanosecond
→ Number
or null
var second
→ Number
or null
var timeZone
→ TimeZone
or null
var year
→ Number
or null
Decimal
The Decimal
class provides support for operating on base-10 numbers, which may not be exactly representable by types like the built-in JavaScript Number
class. Note that Decimal
does not use the built-in arithmetic operations; for example, to add two Decimal
instances, you must use the add()
function.
function fromString(string: String
)
→ Decimal
Parses the given string into a Decimal
. If the string cannot be parsed, notANumber
is returned.
var maximum
→ Decimal
read-onlyReturns the maximum representable Decimal
value.
var minimum
→ Decimal
read-onlyReturns the minimum representable Decimal
value.
var notANumber
→ Decimal
read-onlyReturns a Decimal
that represents a non-number value. Any arithmetic operations involving non-number values will return notANumber
.
var one
→ Decimal
read-onlyReturns a Decimal
representing one.
var zero
→ Decimal
read-onlyReturns a Decimal
representing zero.
function toString()
→ String
Converts the Decimal
to a String
representation.
function add(number: Decimal
) → Decimal
Generates a new Decimal
by adding the argument and the receiver.
function subtract(number: Decimal
) → Decimal
Generates a new Decimal
by subtracting the argument from the receiver.
function multiply(number: Decimal
) → Decimal
Generates a new Decimal
by multiplying the argument and the receiver.
function divide(number: Decimal
) → Decimal
Generates a new Decimal
by dividing the receiver by the argument.
function compare(number: Decimal
) → Number
Compares the receiver and argument. If the receiver is less than the argument, -1 is returned. If the receiver is greater than the argument, 1 is returned. Otherwise, 0 is returned. notANumber
is considered less than any valid number, and equal to itself.
function equals(number: Decimal
) → Boolean
Returns true
if the receiver and argument represent the same number (or both are notANumber
), and false
otherwise.
Dependency
A Dependency
between two tasks.
function remove()
Call to delete this dependency, removing it from it’s prerequisite and dependent tasks.
var dependent
→ Task
read-onlyThe dependent of this dependency, which is the target Task
whose schedule is effected.
var dependentAlignedToEnd
→ Boolean
Whether this dependency aligned to the start or the end date of its dependent task.
var kind
→ DependencyKind
The kind of dependency.
var leadTimeDuration
→ Duration
or null
The lead time before the dependent task, as a duration.
var leadTimePercentage
→ Number
or null
The lead time before the dependent task, as a percentage of the duration of the prerequisite.
var prerequisite
→ Task
read-onlyThe prerequisite of this dependency, which is the source Task
that helps determine when the target Task
is scheduled.
var prerequisiteAlignedToEnd
→ Boolean
Whether this dependency aligned to the start or the end date of its prerequisite task.
DependencyKind
var FinishFinish
→ DependencyKind
read-onlyFrom finish of prerequisite to finish of dependent.
var FinishStart
→ DependencyKind
read-onlyFrom finish of prerequisite to start of dependent.
var Invalid
→ DependencyKind
read-onlyAn invalid dependency kind.
var StartFinish
→ DependencyKind
read-onlyFrom start of prerequisite to end finish of dependent.
var StartStart
→ DependencyKind
read-onlyFrom start of prerequisite to start of dependent.
var all
→ Array
of DependencyKind
read-onlyAn array of all items of this enumeration.
Device
var current
→ Device
read-onlyThe device the current application is running on.
var iOS
→ Boolean
read-onlyA convenience that returns true
on iPhone and iPad devices
var iPad
→ Boolean
read-onlyA convenience that returns true
only on iPad devices, but not on iPhone devices.
var mac
→ Boolean
read-onlyA convenience that returns true
only on Mac devices.
var operatingSystemVersion
→ Version
read-onlyThe current operation system version running on the device
var type
→ DeviceType
or null
read-onlyThe general type of the current device
DeviceType
var all
→ Array
of DeviceType
read-onlyAn array of all items of this enumeration.
var iPad
→ DeviceType
read-onlyAn iPad
var iPhone
→ DeviceType
read-onlyAn iPhone
var mac
→ DeviceType
read-onlyA Mac device
Document
function makeNew(resultFunction: Function
or null
) → Promise
of Document
Create a new document, which can be populated with data and then presented. On iOS, if the document is not presented by the time the resultFunction
returns, it will be closed. On macOS, the document will be left around and accessible to the running script. resultFunction
is executed before any functions tethered to the result Promise are executed. Returns a Promise
that will yield the new document or an error.
function makeNewAndShow(resultFunction: Function
or null
) → Promise
of Document
Create a new document and presents it. Returns a Promise
that will yield the new document or an error.
function close(didCancel: Function
or null
)Close this document. If for some reason the document cannot be closed, the didCancel
function may be called at some point in the future, with the original document as the single argument. For example, on the Mac the user may review unsaved changes and may cancel the close operation. If the document is closed, the didCancel
function will not be called at all.
function save()
Save this document.
function fileWrapper(type: String
or null
)
→ FileWrapper
Deprecated: Please use makeFileWrapper()
instead.
Returns a new FileWrapper
representing the contents of the document formatted as the specified type, or its current fileType
if a null
is passed for the type.
function makeFileWrapper(baseName: String
, type: String
or null
)
→ Promise
of FileWrapper
Generates a FileWrapper
representing the contents of the document formatted as the specified type, or its current fileType
if a null
is passed for the type. Returns a Promise
that will yield the file wrapper or an error. The returned file wrapper will have a name based off the given baseName
and the default path extension for the requested file type.
function undo()
Undo the last done action.
function redo()
Redo the last undone action.
function show(resultFunction: Function
or null
)Presents the document, ordering the window forward on macOS, and possibly closing the existing document and opening the new on on iOS.
var canRedo
→ Boolean
read-onlyWhether there are currently any actions that can be redone.
var canUndo
→ Boolean
read-onlyWhether there are currently any actions that can be undone.
var fileType
→ String
or null
read-onlyThe file type identifier the document uses when saving, if set.
var name
→ String
or null
read-onlyDocument name.
var writableTypes
→ Array
of String
read-onlyA list of all of the file types that this document can be written as.
PlanDocument
: Document
An OmniPlan document.
var project
→ Project
read-onlyProject stored in this document.
var windows
→ Array
of Window
read-onlyCurrently open windows viewing this document.
Duration
A duration.
function workSeconds(s: Number
)
→ Duration
function workHours(h: Number
)
→ Duration
function elapsedHourMinSec(h: Number
, m: Number
, s: Number
)
→ Duration
function elapsedDays(d: Number
)
→ Duration
function elapsedYearMonthDay(y: Number
, m: Number
, d: Number
)
→ Duration
var elapsed
→ Boolean
read-onlyWhether or not this duration is measured in project time or elapsed calendar time.
var elapsedDays
→ Number
read-onlyNumber of days, for a duration measued in elapsed time.
var elapsedHours
→ Number
read-onlyNumber of hours, for a duration measued in elapsed time.
var elapsedMinutes
→ Number
read-onlyNumber of minutes, for a duration measued in elapsed time.
var elapsedMonths
→ Number
read-onlyNumber of months, for a duration measued in elapsed time.
var elapsedSeconds
→ Number
read-onlyNumber of seconds, for a duration measued in elapsed time.
var elapsedWeeks
→ Number
read-onlyNumber of weeks, for a duration measued in elapsed time.
var elapsedYears
→ Number
read-onlyNumber of years, for a duration measued in elapsed time.
var workSeconds
→ Number
read-onlyNumber of project schedule work-seconds of duration, for a duration measured in project time.
Email
A set of parameters for generating an email.
new Email()
→ Email
function generate()
Presents the generated email to the user for them to send (or discard). On iOS, any included attachment FileWrapper
s that are directories will be converted to Zip files.
var blindCarbonCopy
→ String
or null
var body
→ String
or null
var carbonCopy
→ String
or null
var fileWrappers
→ Array
of FileWrapper
var receiver
→ String
or null
var subject
→ String
or null
Error
The built-in JavaScript Error
constructor.
FilePicker
A FilePicker
allows the user to select URL
s for files via the system-supplied file picking interface.
new FilePicker()
→ FilePicker
Returns a new FilePicker
with default settings.
function show()
→ Promise
of Array
of URL
Presents the system file selection interface to the user, allowing them to choose one or more files of the given types. The returned Promise
will yield the chosen URL
s on success. If the user cancels chosing, the Promise
will be rejected. Note that even when picking a single file or folder, the result will be an array of URL
s.
var folders
→ Boolean
If true
, then folders may be selected, but not files. In this case, types
is ignored. Defaults to false
.
var message
→ String
A message to display describing what files are being picked. This is currently only supported on macOS.
var multiple
→ Boolean
If true
, then multiple files may be selected. Defaults to false
.
var types
→ Array
of TypeIdentifier
or null
The file types that will be allowed. If null
, all file types will be allowed. Defaults to null
.
FileSaver
A FileSaver
allows the user to save a FileWrapper
to a URL
s via the system-supplied file picking interface.
new FileSaver()
→ FileSaver
Returns a new FileSaver
with default settings.
function show(fileWrapper: FileWrapper
) → Promise
of URL
Presents the system file saving interface to the user, allowing them to choose a location and file name to save the file wrapper. The returned Promise
will yield the chosen URL
on success. If the user cancels chosing, the Promise
will be rejected.
var message
→ String
A message to display describing what file is being saved. This is currently only supported on macOS.
var nameLabel
→ String
The label shown next to the user-editable file name field. This is currently only supported on macOS.
var prompt
→ String
The prompt shown on the the save button. This is currently only supported on macOS.
var types
→ Array
of TypeIdentifier
or null
The file types that will be allowed. If null
, all file types will be allowed. Defaults to null
.
FileWrapper
function withContents(name: String
or null
, contents: Data
) → FileWrapper
Returns a new FileWrapper
that represents a flat file containing the given data.
function withChildren(name: String
or null
, children: Array
of FileWrapper
) → FileWrapper
Returns a new FileWrapper
that represents a directory with the given child file wrappers. Each child file wrapper must have a unique name specified.
function filenameForChild(child: FileWrapper
) → String
or null
Returns the unique file name that will be used for the given child FileWrapper
, or null
if this file wrapper is not a child of the receiver.
var children
→ Array
of FileWrapper
read-onlyReturns an Array
of child FileWrappers
, if this represents a directory. Otherwise, an empty array is returned.
var contents
→ Data
or null
read-onlyReturns the regular file contents of the wrapper, if this represents a regular file. Otherwise, null
is returned.
var destination
→ URL
or null
read-onlyReturns the destination if this represents a symbolic link. Otherwise, null
is returned.
var filename
→ String
or null
Returns the actual file name that was last read for this file wrapper. Depending on the names of other sibling wrappers, this may not be what file name will be written.
var preferredFilename
→ String
or null
Returns the preferred file name that should be used when writing the file wrapper if no other file in the same parent directory wrapper is in use.
var type
→ FileWrapper.Type
read-onlyReturns the type of this FileWrapper
.
FileWrapper.Type
var Directory
→ FileWrapper.Type
read-onlyA FileWrapper
that represents a directory with zero or more child wrappers.
var File
→ FileWrapper.Type
read-onlyA FileWrapper
that represents a regular file with data contents.
var Link
→ FileWrapper.Type
read-onlyA FileWrapper
that represents a symbolic link to another location.
var all
→ Array
of FileWrapper.Type
read-onlyAn array of all items of this enumeration.
Form
Form
provides a mechanism to collect input from the user. Each form contains one or more instances of subclasses of Field
, which are given a key. As the form is filled out, values
object is populated with the values from the user interface.
new Form()
→ Form
function addField(field: Form.Field
, index: Number
or null
)Adds the new Field
to the Form
, at the indicated position, or at the end if no position is specified. If the field has a default value, it will be added to the values
result object immediately.
function removeField(field: Form.Field
)Removes the Field from the
Form. Any entry in the
values` for this field will be removed as well.
function show(title: String
, confirmTitle: String
)
→ Promise
of Form
Present the Form
to the user, and return a Promise
to be fullfilled or rejected when the user commits or cancels the form.
var fields
→ Array
of Form.Field
read-onlyThe current Field
instances in the form, which will be visible to the user entering input.
var validate
→ Function
or null
A function to check whether the entered values are acceptable. The form to validate is passed as the argument and the function is expected to return a boolean result or null to perform default validation. If an Error
is thrown, it’s message will be displayed in the form as the reason for validation failure. Note that the validation function may add or remove fields and update entries in the values
object (which will cause the interface to be updated). This is called any time the user edits values, or a field is added or removed. If no validate
function is specified or it returns null
, some per-field default validation will be performed (see Form.Field.Option
. If the validate
function returns a boolean result, no default validation will be performed.
var values
→ Object
read-onlyAn object with the collected values for each field, stored under the key for that field.
Form.Field
A single entry for a user input value in a Form
. Each field can only be added to a single Form
. This class cannot be constructed directly.
var displayName
→ String
or null
read-onlyHuman readable string used as the label for this field.
var key
→ String
read-onlyKey to use when storing the value for this field in the containing form’s values
object.
Form.Field.Checkbox
: Form.Field
new Form.Field.Checkbox(key: String
, displayName: String
or null
, value: Boolean
or null
)
→ Form.Field.Checkbox
Returns a new Checkbox
field, optionally with an initial value (which will be false
if no value is specified).
Form.Field.Date
: Form.Field
new Form.Field.Date(key: String
, displayName: String
or null
, value: Date
or null
, formatter: Formatter.Date
or null
) → Form.Field.Date
Returns a new Date
field, optionally with an initial value, and optionally a date formatter. If no formatter is specified, a default one will be created that follows the user’s date formatting preferences to display and determine component ordering when parsing dates. Relative dates like “1d”, “tomorrow”, “now” can also be entered.
Form.Field.MultipleOptions
: Form.Field
new Form.Field.MultipleOptions(key: String
, displayName: String
or null
, options: Array
of Object
, names: Array
of String
or null
, selected: Array
of Object
) → Form.Field.MultipleOptions
Returns a new MultipleOptions
field, allowing the user to pick multiple items from a list of option objects. A list of names may also be given, which must have the same length as the options array if so. If no names are given, the objects are converted to strings for display. An array of zero or more initially selected objects (which must be members of the options array) may also be given. An empty array is valid input for the initially selected items. Additionally, it is valid for MultipleOptions
fields to have a value that is an empty array.
Form.Field.Option
: Form.Field
new Form.Field.Option(key: String
, displayName: String
or null
, options: Array
of Object
, names: Array
of String
or null
, selected: Object
or null
, nullOptionTitle: String
or null
) → Form.Field.Option
Returns a new Option
field, allowing the user to pick from a list of option objects. A list of names may also be given, which must have the same length as the options array if so. If no names are given, the objects are converted to strings for display. An initially selected object (which must be a member of the options array) may also be given. If the field is not configured to allow a null
value and no initially selected
value is specified, the user must select a value before the field is considered valid under the default form validation.
var allowsNull
→ Boolean
If set to true
, an option will be added to allow selecting null
.
var nullOptionTitle
→ String
or null
If null
is allowed, this will be used for the title of that option. Otherwise a default title will be used.
Form.Field.Password
: Form.Field
A field for text-based input, optionally using a Formatter
to convert the string value into a different type.
new Form.Field.Password(key: String
, displayName: String
or null
, value: String
or null
)
→ Form.Field.Password
Returns a new Password
field, optionally with an initial value. The displayed text will be obscured.
Form.Field.String
: Form.Field
A field for text-based input, optionally using a Formatter
to convert the string value into a different type.
new Form.Field.String(key: String
, displayName: String
or null
, value: Object
or null
, formatter: Formatter
or null
) → Form.Field.String
Returns a new String
field, optionally with an initial value and formatter. If a formatter is specified, the value should be of the output type from the formatter or null. If no formatter is specified, the value should be a string or null.
Formatter
Formatter.Date
: Formatter
function withStyle(dateStyle: Formatter.Date.Style
, timeStyle: Formatter.Date.Style
or null
) → Formatter.Date
A formatter that will display dates according to the specified date and time formats selected in system settings.
function withFormat(format: String
)
→ Formatter.Date
Returns a formatter with a specific ICU date format and the user’s current locale, calendar, and timeZone. See http://userguide.icu-project.org/formatparse/datetime/ for details on date format strings.
var iso8601
→ Formatter.Date
read-onlyReturn a date formatter that produces ISO-8601 formatted dates, using the Gregorian calendar and the UTC time zone.
function stringFromDate(date: Date
)
→ String
function dateFromString(string: String
)
→ Date
or null
var calendar
→ Calendar
var dateFormat
→ String
read-onlyvar locale
→ Locale
var timeZone
→ TimeZone
Formatter.Decimal
: Formatter
This formatter class formats and parses Decimal
-valued strings (note, not Number
values).
function currency(code: String
or null
)
→ Formatter.Decimal
Returns a new formatter that will display the value as a currency value. An ISO currency code may be specified to pick a specific currency, or null may be passed to use the default currency for the user’s locale. If the argument is not a valid currency code, an error will be thrown.
var currencyCodes
→ Array
of String
read-onlyDeprecated: Please use the currencyCode
property on Locale
instead.
Returns the list of known ISO currency codes
var custom
→ Formatter.Decimal
read-onlyReturns a new formatter that can be configured with custom settings.
var decimal
→ Formatter.Decimal
read-onlyReturns a new number formatter that will use both a decimal separator.
var percent
→ Formatter.Decimal
read-onlyReturns a new number formatter that will display the value as a percentage.
var percentWithDecimal
→ Formatter.Decimal
read-onlyReturns a new number formatter that will display the value as a percentage with a decimal separator.
var plain
→ Formatter.Decimal
read-onlyReturns a new number formatter that will not use any separators.
var thousandsAndDecimal
→ Formatter.Decimal
read-onlyReturns a new number formatter that will use both a thousands and decimal separator.
function stringFromDecimal(number: Decimal
) → String
or null
Format a Decimal
as a string, based on the rules set on the formatter.
function decimalFromString(string: String
)
→ Decimal
or null
Parses a Decimal
from a string, based on the rules set on the formatter. Returns null
if the value was not recognized.
var decimalSeparator
→ String
The string to display between the whole portion of a number and the decimal portion.
var negativeFormat
→ String
A format string to use for negative values.
var positiveFormat
→ String
A format string to use for positive values.
var thousandsSeparator
→ String
or null
The string to display between groups of digits representing powers of a thousand.
var zeroSymbol
→ String
or null
The string to use when displaying a zero value. If this is null
, the positiveFormat
is used.
Formatter.Duration
: Formatter
new Formatter.Duration()
→ Formatter.Duration
function stringFromDecimal(number: Decimal
) → String
or null
function decimalFromString(string: String
)
→ Decimal
or null
var hoursPerDay
→ Number
var hoursPerWeek
→ Number
var useVerboseFormat
→ Boolean
Formatter.Date.Style
var Full
→ Formatter.Date.Style
read-onlyUse the user’s “full” format as selected in system settings.
var Long
→ Formatter.Date.Style
read-onlyUse the user’s “long” format as selected in system settings.
var Medium
→ Formatter.Date.Style
read-onlyUse the user’s “medium” format as selected in system settings.
var Short
→ Formatter.Date.Style
read-onlyUse the user’s “short” format as selected in system settings.
var all
→ Array
of Formatter.Date.Style
read-onlyAn array of all items of this enumeration.
Function
The built-in JavaScript Function
constructor.
Image
Locale
var identifiers
→ Array
of String
read-onlyThe list of known ISO locale identifiers.
new Locale(identifier: String
)
→ Locale
var calendar
→ Calendar
read-onlyThe calendar for the locale.
var currencyCode
→ String
or null
read-onlyThe currency code for the locale.
var identifier
→ String
read-onlyThe ISO locale identifier for this object.
MenuItem
var checked
→ Boolean
If true, a checkmark is displayed next to the MenuItem
’s label.
var label
→ String
The string displayed to describe the MenuItem
’s action.
Pasteboard
A pasteboard temporarily holds representations of items of different types for transfer between different applications or different locations in the application.
function makeUnique()
→ Pasteboard
Creates a new unique pasteboard.
var general
→ Pasteboard
read-onlyThe Pasteboard
used for user-initiated copy/paste support.
function availableType(types: Array
of TypeIdentifier
) → TypeIdentifier
or null
The first type from the provided list which is available on the pasteboard, or null
if none are available.
function addItems(items: Array
of Pasteboard.Item
)Appends the new items to the pasteboard.
function clear()
Remove all items from the pasteboard.
function dataForType(type: TypeIdentifier
) → Data
or null
The Data
representation for the given type in this pasteboard, or null
if none is available.
function setDataForType(data: Data
, type: TypeIdentifier
)Set the Data
representation for the given type in this pasteboard, replacing any previously set data.
function stringForType(type: TypeIdentifier
) → String
or null
The String
representation for the given type in this pasteboard, or null
if none is available.
function setStringForType(string: String
, type: TypeIdentifier
)Set the String
representation for the given type in this pasteboard, replacing any previously set data.
var URL
→ URL
or null
Gets or sets the pasteboard content as a single URL.
var URLs
→ Array
of URL
or null
Gets or sets the pasteboard content as a list of URLs.
var color
→ Color
or null
Gets or sets the pasteboard content as a single color.
var colors
→ Array
of Color
or null
Gets or sets the pasteboard content as a list of colors.
var hasColors
→ Boolean
read-onlyReturns true
if the pasteboard contains one or more colors.
var hasImages
→ Boolean
read-onlyReturns true
if the pasteboard contains one or more images.
var hasStrings
→ Boolean
read-onlyReturns true
if the pasteboard contains one or more strings.
var hasURLs
→ Boolean
read-onlyReturns true
if the pasteboard contains one or more URLs.
var image
→ Image
or null
Gets or sets the pasteboard content as a single image.
var images
→ Array
of Image
or null
Gets or sets the pasteboard content as a list of images.
var items
→ Array
of Pasteboard.Item
The array of individual items on the pasteboard, each potentially with their own set of types.
var string
→ String
or null
Gets or sets the pasteboard content as a single plain-text string.
var strings
→ Array
of String
or null
Gets or sets the pasteboard content as a list of plain-text strings.
var types
→ Array
of TypeIdentifier
read-onlyThe list of pasteboard types currently available on the pasteboard.
Pasteboard.Item
new Pasteboard.Item()
→ Pasteboard.Item
Make a new empty pasteboard item with no contents.
function dataForType(type: TypeIdentifier
) → Data
or null
The Data
representation for the given type in this pasteboard item, or null
if none is available.
function setDataForType(data: Data
, type: TypeIdentifier
)Set the Data
representation for the given type in this pasteboard item, replacing any previously set data.
function stringForType(type: TypeIdentifier
) → String
or null
The String
representation for the given type in this pasteboard item, or null
if none is available.
function setStringForType(string: String
, type: TypeIdentifier
)Set the String
representation for the given type in this pasteboard item, replacing any previously set data.
var types
→ Array
of TypeIdentifier
read-onlyThe list of types available for this pasteboard item.
PlugIn
function find(identifier: String
, minimumVersion: Version
or null
) → PlugIn
or null
var all
→ Array
of PlugIn
read-onlyfunction library(identifier: String
)
→ Object
or null
Looks for a PlugIn.Library
in the receiver and returns it if found.
function action(identifier: String
)
→ PlugIn.Action
or null
function handler(identifier: String
)
→ PlugIn.Handler
or null
function resourceNamed(name: String
)
→ URL
or null
function imageNamed(name: String
)
→ Image
or null
var URL
→ URL
or null
read-onlyReturns the original URL from whence this PlugIn
came, if known.
var actions
→ Array
of PlugIn.Action
read-onlyvar author
→ String
read-onlyReturns the author for the PlugIn
.
var description
→ String
read-onlyReturns the description provided for the PlugIn
.
var displayName
→ String
read-onlyReturns the localized, human-readable name for the PlugIn
.
var handlers
→ Array
of PlugIn.Handler
read-onlyvar identifier
→ String
read-onlyThe unique identifier of the PlugIn
.
var libraries
→ Array
of PlugIn.Library
read-onlyvar version
→ Version
read-onlyReturns the current Version
for the PlugIn
.
PlugIn.Action
new PlugIn.Action(perform: Function
) → PlugIn.Action
Returns a new PlugIn.Action
. Only used within an action JavaScript file embedded within a PlugIn.
var description
→ String
read-onlyvar label
→ String
read-onlyReturns the default label to use for interface controls that invoke the action.
var longLabel
→ String
read-onlyReturns the label to use for interface controls that invoke the action, when a long amount of space is available.
var mediumLabel
→ String
read-onlyReturns the label to use for interface controls that invoke the action, when a medium amount of space is available.
var name
→ String
read-onlyReturns the name of the PlugIn.Action
.
var paletteLabel
→ String
read-onlyReturns the label to use for interface controls that show a prototype of the action control, such as on a macOS toolbar configuration sheet.
var perform
→ Function
read-onlyvar plugIn
→ PlugIn
read-onlyReturns the PlugIn
that contains this object.
var shortLabel
→ String
read-onlyReturns the label to use for interface controls that invoke the action, when a short amount of space is available.
var validate
→ Function
or null
A function to check whether the action is supported, given the current application state, as determined by the arguments passed (typically including the selection). This optional Function may be configured while the Action
is being loaded, but after that the Action
will be frozen.
PlugIn.Handler
new PlugIn.Handler(invoke: Function
) → PlugIn.Handler
Returns a new PlugIn.Handler
. Only used within an handler JavaScript file embedded within a PlugIn.
var invoke
→ Function
read-onlyThe Function
that will be executed for each handler registered for an event posted by an application object.
var name
→ String
read-onlyReturns the name of the PlugIn.Handler
.
var plugIn
→ PlugIn
read-onlyReturns the PlugIn
that contains this object.
var willAttach
→ Function
or null
An optional Function
that can be set on PlugIn.Handler
as it is being loaded (but not after). This function is passed the application object that post events to trigger the handler. The return value should be a state object that is JSON archivable (or undefined
if the handler has no state to maintain across invocations).
var willDetach
→ Function
or null
An optional Function
that can be set on PlugIn.Handler
as it is being loaded (but not after). Called when a previously attached PlugIn.Handler
is being detached from an application object. Any return value or thrown error are ignored.
PlugIn.Handler.Registration
function remove()
Removes a previously added event observation.
PlugIn.Library
An object that represents a library from a plug-in.
new PlugIn.Library(version: Version
) → PlugIn.Library
Returns a new Library
. Typically only used within a library JavaScript file embedded within a PlugIn.
var name
→ String
read-onlyReturns the name of the PlugIn.Library
.
var plugIn
→ PlugIn
read-onlyReturns the PlugIn
that contains this object.
var version
→ Version
read-onlyReturns the Version
of this library, as passed to the constructor.
Project
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.
function customValue(forKey: String
)
→ String
or null
Access to custom data values.
function setCustomValue(forKey: String
, to: String
)
Change custom data values.
function baselineNamed(name: String
)
→ Scenario
or null
Load the given named baseline scenario, if necessary, and return it.
var actual
→ Scenario
read-onlyThe scenario containing actual values for all tasks and resources, as opposed to baselines.
var baselineNames
→ Array
of String
read-onlyNames of all of the baseline scenarios.
var document
→ PlanDocument
or null
read-onlyDocument that stores this project.
var title
→ String
Title of this project.
Promise
The built-in JavaScript Promise
constructor.
Resource
A Resource
.
function customValue(forKey: String
)
→ String
or null
Access to custom data values.
function setCustomValue(forKey: String
, to: String
)
Change custom data values.
function addMember()
→ Resource
Create new resource member and makes this resource into a group.
function descendents()
→ Array
of Resource
All descendents from this group.
function remove()
Delete this resource and remove it from the project, along with any associated assignments.
var assignments
→ Array
of Assignment
read-onlyAssignments of this resource to tasks.
var completedCost
→ Decimal
read-onlyExpenditure on this resource that has already happened for work performed.
var costPerHour
→ Decimal
Cost per hour of work performed.
var costPerUse
→ Decimal
Cost per task that this resource is assigned to.
var efficiency
→ Number
Amount of work actually performed per time. Defaults to 1.0 (100%).
var email
→ String
or null
Email address of this resource.
var members
→ Array
of Resource
read-onlyMember resources of this group.
var name
→ String
Name of this resource.
var note
→ String
Note for this resource.
var schedule
→ Schedule
read-onlySchedule for this resource.
var totalCost
→ Decimal
read-onlyTotal planned expenditure on this resource.
var totalHours
→ Number
read-onlyTotal assigned hours.
var type
→ ResourceType
Resource type for this resource.
var uniqueID
→ Number
read-onlyUnique ID number of this resource.
var unitsAvailable
→ Number
Number of units of this resource available for this project.
ResourceAssignmentType
var adjustAssignedUnits
→ ResourceAssignmentType
read-onlyWhen changing resource assignments, adjust other assignments’ units.
var adjustDuration
→ ResourceAssignmentType
read-onlyWhen changing resource assignments, adjust the task duration.
var adjustEffort
→ ResourceAssignmentType
read-onlyWhen changing resource assignments, adjust the task effort.
var all
→ Array
of ResourceAssignmentType
read-onlyAn array of all items of this enumeration.
ResourceCalendar
var events
→ Array
of CalendarEvent
read-onlyAll events in this calendar.
var name
→ String
read-onlyName of this calendar.
var overtime
→ Boolean
read-onlyWhether events in this calendar represents overtime for the resource/project or vacation/off-time.
ResourceType
var all
→ Array
of ResourceType
read-onlyAn array of all items of this enumeration.
var equipment
→ ResourceType
read-onlyA resource that is shared amongst tasks like staff but normally contributes no work itself (efficiency defaults to zero).
var group
→ ResourceType
read-onlyA group of other resources.
var material
→ ResourceType
read-onlyA material - instead of having limited units to be shared amongst tasks, materials count up their total uses.
var staff
→ ResourceType
read-onlyA normal resource that performs work.
Scenario
A Scenario
represents a set of tasks and resources and associated schedules. The actuals for a project are one scenario, and saved baselines are the others.
function taskNamed(name: String
)
→ Task
or null
Get a given task by name. If there is more than one with the same name, only returns the first.
function resourceNamed(name: String
)
→ Resource
or null
Get a given resource by name. If there is more than one with the same name, only returns the first.
var completed
→ Number
read-onlyOverall project percentage completed.
var endDate
→ Date
Overall project end date.
var hasFixedEndDate
→ Boolean
Whether tasks in this scenario scheduled forward from a fixed overall start, or backwards from a fixed overall end.
var hasGenericDates
→ Boolean
Generic dates (e.g. “Day 1”, “Day 12”) vs actual dates (e.g. “Jan 1, 2019”)
var milestones
→ Array
of Task
read-onlyA list of all milestones in the project.
var name
→ String
Name of this scenario.
var rootResource
→ Resource
read-onlyRoot resource of the project. This is a hidden group which contains all top-level resources.
var rootTask
→ Task
read-onlyRoot task of the project. This is a hidden group which contains all top-level tasks.
var schedule
→ Schedule
read-onlyThe overall project schedule.
var startDate
→ Date
Overall project start date.
var totalCost
→ Decimal
read-onlyOverall project total cost.
Schedule
function endDate(start: Date
, duration: Duration
) → Date
Compute the end date for a given start date and duration in this schedule.
function startDate(end: Date
, duration: Duration
) → Date
Compute the start date for a given end date and duration in this schedule.
function durationBetween(start: Date
, end: Date
)
→ Duration
Compute the work-second duration between a given start date and end date in this schedule.
var calendars
→ Array
of ResourceCalendar
read-onlyAll calendars in this schedule. OmniPlan manages two built-in calendars for each schedule: an off-time calendar and an overtime calendar. Additional calendars may be added by synchronizing with Calendar.app or ical URLs, etc.
Selection
The ‘selection’ argument to plugin actions, letting them inspect the selection.
var document
→ PlanDocument
or null
read-onlyThe current document.
var project
→ Project
or null
read-onlyThe current project.
var resources
→ Array
of Resource
read-onlyThe currently selected resources.
var tasks
→ Array
of Task
read-onlyThe currently selected tasks.
var window
→ Window
or null
read-onlyThe current window.
SharePanel
An interface that can display the system share interaction for the given items.
new SharePanel(items: Array
of URL
, String
, Image
, or FileWrapper
) → SharePanel
Create a new share panel with the given items.
function addItem(shareItem: URL
, String
, Image
, or FileWrapper
)Appends the item to the end of items
.
function addItems(shareItems: Array
of URL
, String
, Image
, or FileWrapper
)Appends the contents of the given array to the end of items
.
function removeItem(shareItem: URL
, String
, Image
, or FileWrapper
)Removes the first occurrence of the item from items
if it is present in items
.
function removeItems(shareItems: Array
of URL
, String
, Image
, or FileWrapper
)Removes the first occurrence of each member of the given array from items
if that member is present in items
.
function clearItems()
Sets items
to an empty array. Note: Calling show
when items
is empty results in an error, so be sure to add new items after calling this and before calling show
.
function show()
Presents the share panel for its items. Calling this when items
is empty will result in an error.
var items
→ Array
of URL
, String
, Image
, or FileWrapper
The items that will be supplied to the system share interaction upon calling show
.
Task
A Task
.
function customValue(forKey: String
)
→ String
or null
Access to custom data values.
function setCustomValue(forKey: String
, to: String
)
Change custom data values.
function descendents()
→ Array
of Task
All tasks which are descended from this one.
function clearResourceLeveledDate()
Remove the effects of resource leveling from this task.
function addPrerequisite(to: Task
) → Dependency
Create a new dependency where the passed in task is the prerequisite and this task is the dependent.
function addDependent(to: Task
) → Dependency
Create a new dependency where the passed in task is the dependent and this task is the prerequisite.
function addAssignment(to: Resource
) → Assignment
Create a new assignment to the given resource.
function addSubtask()
→ Task
Create a new subtask, and making this task into a group.
function split(at: Date
, resumingAt: Date
)
→ Boolean
Divide this task into multiple split chunks, with the same name, overall effort, and assignments, but with any duration after the split date moved to begin at the resume date.
function remove()
Delete this task and remove it from the project, along with any associated dependencies and assignments.
var absoluteEndLimit
→ Date
read-onlyLatest that this task could end without effecting the overall start or end of the project.
var absoluteStartLimit
→ Date
read-onlyEarliest that this task could start without effecting the overall start or end of the project.
var assignments
→ Array
of Assignment
read-onlyResources assigned to this task.
var assignmentsCost
→ Decimal
read-onlyThe cost of assigned resources to this task (per use and per hour costs).
var currentEndLimit
→ Date
read-onlyLatest that this task could end without effecting any other connected task.
var currentStartLimit
→ Date
read-onlyEarliest that this task could start without effecting any other connected task.
var dependents
→ Array
of Dependency
read-onlyDependencies where this task is the prerequisite task.
var duration
→ Duration
or null
Duration of the task.
var effort
→ Number
Total effort needed to complete this task in person-seconds.
var effortDone
→ Number
Effort already accomplished upon this task in person-seconds.
var effortRemaining
→ Number
Effort remaining until completion of this task in person-seconds.
var endDate
→ Date
read-onlyScheduled end date.
var endNoEarlierThanDate
→ Date
or null
Constraint that this task must end no earlier than the given date, if any.
var endNoLaterThanDate
→ Date
or null
Constraint that this task must end no later than the given date, if any.
var expectedEffortEstimate
→ Number
Three-point estimation expected effort estimate in person-seconds.
var freeSlack
→ Number
read-onlyFree slack (or float) is how much time a task can be delayed before any other connected task is effected.
var manualEndDate
→ Date
or null
Manual end date of this task, if any.
var manualStartDate
→ Date
or null
Manual start date of this task, if any.
var maxEffortEstimate
→ Number
Three-point estimation maximum effort estimate in person-seconds.
var minEffortEstimate
→ Number
Three-point estimation minimum effort estimate in person-seconds.
var note
→ String
Note for this task.
var prerequisites
→ Array
of Dependency
read-onlyDependencies where this task is the dependent task.
var priority
→ Number
Priority of this task during resource leveling. The higher the priority, the sooner leveling will attempt to schedule the task.
var resourceAssignmentType
→ ResourceAssignmentType
How this task should react when resources are assigned to it.
var resourceLeveledDate
→ Date
or null
read-onlyThe date that resource leveling has determined that this task ought to be scheduled at. May be missing if resource leveling
isn’t needed to place this task. (E.g. if the task is manually scheduled or otherwise already scheduled at an appropriate date.)
var resourceLevelingDelay
→ Number
read-onlyThe amount of time that resource leveling needs to delay this task beyond when it could otherwise be scheduled.
var startDate
→ Date
read-onlyScheduled start date.
var startNoEarlierThanDate
→ Date
or null
Constraint that this task must start no earlier than the given date, if any.
var startNoLaterThanDate
→ Date
or null
Constraint that this task must start no later than the given date, if any.
var staticCost
→ Decimal
The built-in cost of performing this task.
var subtasks
→ Array
of Task
read-onlyChild tasks contained within this task group, or split chunks of this task, if it is split.
var title
→ String
Title of this task.
var totalCost
→ Decimal
read-onlyThe sum of static and assignment costs.
var totalSlack
→ Number
read-onlyTotal slack (or float) is how much time a task can be delayed before effecting the overall start or end of the project.
var type
→ TaskType
Type of this task.
var uniqueID
→ Number
read-onlyUnique ID number of this task.
TaskType
var all
→ Array
of TaskType
read-onlyAn array of all items of this enumeration.
var group
→ TaskType
read-onlyA container for other tasks.
var hammock
→ TaskType
read-onlyA task whose length is determined by its dependencies rather than from a fixed effort or duration.
var milestone
→ TaskType
read-onlyA milestone. Has zero duration.
var task
→ TaskType
read-onlyA standard task.
TimeZone
var abbreviations
→ Array
of String
read-onlyThe list of known time zone abbreviations.
new TimeZone(abbreviation: String
)
→ TimeZone
or null
Make a new TimeZone
with the given abbreviation. Note that the returned TimeZone
may have a different abbreviation than the passed argument. For example, if one of “PST” or “PDT” is requested that doens’t match the current use of daylight savings time, the one that does match will be returned.
var abbreviation
→ String
or null
read-onlyThe abbreviation for the TimeZone
.
var daylightSavingTime
→ Boolean
read-onlyReturns true
if the TimeZone
is currently using daylight savings time.
var secondsFromGMT
→ Number
read-onlyThe current difference in seconds between this TimeZone
and GMT.
Timer
function once(interval: Number
, action: Function
) → Timer
Makes a new Timer
that will fire once, after the specified interval (in seconds from the current time). When the Timer
fires, the passed in Function
is called, passing the Timer
as its argument.
function repeating(interval: Number
, action: Function
) → Timer
Makes a new Timer
that will fire repeatedly with the specified interval (in seconds, with the first invocation happening that interval after the current time). When the Timer
fires, the passed in Function
is called, passing the Timer
as its argument.
function cancel()
var interval
→ Number
read-onlyToolbarItem
var image
→ Image
or null
var label
→ String
var toolTip
→ String
or null
TypeIdentifier
var URL
→ TypeIdentifier
read-onlyThe URL type.
var binaryPropertyList
→ TypeIdentifier
read-onlyThe binary property list type.
var csv
→ TypeIdentifier
read-onlyThe comma-separated text type.
var editableTypes
→ Array
of TypeIdentifier
read-onlyThe list of TypeIdentifier
s that can be read and written natively by documents in this application.
var gif
→ TypeIdentifier
read-onlyThe GIF image type.
var image
→ TypeIdentifier
read-onlyA generic type that all image types conform to.
var jpeg
→ TypeIdentifier
read-onlyThe JPEG image type.
var json
→ TypeIdentifier
read-onlyThe JSON type.
var pdf
→ TypeIdentifier
read-onlyThe PDF type.
var plainText
→ TypeIdentifier
read-onlyThe plain text type.
var png
→ TypeIdentifier
read-onlyThe PNG image type.
var propertyList
→ TypeIdentifier
read-onlyThe generic property list type.
var readableTypes
→ Array
of TypeIdentifier
read-onlyThe list of TypeIdentifier
s that can be read by documents in this this application.
var rtf
→ TypeIdentifier
read-onlyThe RTF type.
var rtfd
→ TypeIdentifier
read-onlyThe RTFD type.
var tiff
→ TypeIdentifier
read-onlyThe TIFF image type.
var writableTypes
→ Array
of TypeIdentifier
read-onlyThe list of TypeIdentifier
s that can be written by documents in this application (though some documents may be exportable only in a subset of these types).
var xmlPropertyList
→ TypeIdentifier
read-onlyThe XML property list type.
new TypeIdentifier(identifier: String
)
→ TypeIdentifier
Returns a new FileType
with the given identifier.
function conformsTo(other: TypeIdentifier
) → Boolean
Returns true
if the instance is the same as the given argument or a more specific type. For example, TypeIdentifier.png.conformsTo(TypeIdentifier.image)
will be true
, but TypeIdentifier.png.conformsTo(TypeIdentifier.plainText)
will be false
.
var displayName
→ String
read-onlyReturns a human-readable description of the type.
var identifier
→ String
read-onlyReturns a unique string for a type identifier, suitable for archiving or encoding in scripts.
var pathExtensions
→ Array
of String
read-onlyThe list of filesystem path extensions used by this type.
URL
function choose(types: Array
of String
)
→ URL
or null
Deprecated: Please use FilePicker
instead.
Allows the user to choose a file URL
if possible and returns a new instance, or null
otherwise.
function chooseFolder()
→ URL
or null
Deprecated: Please use FilePicker
instead.
Allows the user to choose a folder URL
if possible and returns a new instance, or null
otherwise.
function fromString(string: String
)
→ URL
or null
Parses the string as a URL
if possible and returns a new instance, or null
otherwise.
function tellScript(app: String
, js: String
, arg: Object
or null
) → URL
or null
Creates a URL
to invoke the given JS on the given app (url scheme) appropriate for use with the call function.
function tellFunction(app: String
, jsFunction: Function
, arg: Object
or null
) → URL
or null
Creates a URL
to invoke the given JS function on the given app (url scheme) appropriate for use with the call function.
var currentAppScheme
→ String
read-onlyReturns the URL scheme for the current app.
function fetch(success: Function
, failure: Function
or null
)Get the contents at the destination of this URL.
function call(success: Function
, failure: Function
or null
)Invoke an x-callback-url API end-point, with the callback functions being invoked when a reply is received. When a reply is received, the parameters of that URL are decoded as JSON, or left as String values if not valid JSON, and stored as properties of a result object. For a successful reply, if the result object has one property, its value is passed as the first argument to the success function. If there are zero or more than one parameters, the full object is passed as the first argument. In both cases, the success function is passed a second argument that is the full object of parameters. The failure callback is always passed the object will all the result parameters, typically errorCode
and errorMessage
.
function open()
Ask the system to open this URL.
function find(types: Array
of TypeIdentifier
, recurse: Boolean
or null
) → Promise
of Array
of URL
Scan a directory URL
for files of the given types. If recurse
is specified and is false, only the immediate contents of the directory will be considered. If recurse
is not specified or is true
, the full directory tree will be scanned.
function toString()
→ String
function appendingPathComponent(component: String
)
→ URL
function deletingLastPathComponent()
→ URL
var string
→ String
read-onlyString representation of this URL.
var toObject
→ Object
or null
read-onlyURL.FetchRequest
function fromString(string: String
)
→ URL.FetchRequest
or null
Parses the string as a URL
if possible and returns a new instance, or null
otherwise.
new URL.FetchRequest()
→ URL.FetchRequest
Creates a new instance.
function fetch()
→ Promise
of URL.FetchResponse
Perform the request, returning a Promise
. On success, the promise will resolve to a URL.FetchResponse
.
var bodyData
→ Data
or null
The body of the request, typically used in an HTTP POST
or PUT
request. This API is suitable for uploading binary data, or for text which needs to be encoded in a form other than UTF-8. If UTF-8 text is suitable, bodyString
is likely to be a better choice.
var bodyString
→ String
or null
The body of the request, typically used in an HTTP POST
or PUT
request. The provided string will be transmitted using the UTF-8 encoding.
var cache
→ String
or null
The cache policy for the request: default
, no-store
, reload
, no-cache
, force-cache
, or only-if-cached
.
var headers
→ ObjectCustom HTTP headers to be sent with this request.
var method
→ String
or null
The HTTP request method of the request: GET
, POST
, PUT
, DELETE
, etc.
var url
→ URL
or null
The URL for this fetch request. Much of the additional functionality provided by the fetch request API will only work with http
and https
URLs. (For example, the method
and cache
and headers
don’t have any effect in the context of a file
or omnifocus
URL.)
URL.FetchResponse
URL.FetchResponse
represents the response from fetching a URL resource, providing additional information about the response such as the HTTP status code and headers along with the actual data for that response. This is a read-only object returned by performing a URL.FetchRequest
; see that class for more details on actually performing the request.
var bodyData
→ Data
or null
read-onlyReturns the raw HTTP body data from this response.
var bodyString
→ String
or null
read-onlyThis is a convenience wrapper which interprets the bodyData
of this response as UTF-8 text. (Note: the current implementation assumes the text is encoded using UTF-8, but ideally it would honor the text encoding as reported by textEncodingName
.)
var headers
→ Object read-onlyReturns the HTTP header fields for this response.
var mimeType
→ String
or null
read-onlyReturns the HTTP MIME type for this response (e.g. text/plain
, application/json
, etc.).
var statusCode
→ Number
read-onlyReturns the HTTP status code for this response (e.g. 200
, 404
, etc.).
var textEncodingName
→ String
or null
read-onlyReturns the reported text encoding for this response. This name will be the actual string reported by the origin source, or null
if no encoding was specified.
var url
→ URL
or null
read-onlyReturns the URL for this response.
Version
new Version(versionString: String
)
→ Version
Parses a string representation of a Version
and returns an instance, or throws an error if the string isn’t a valid version.
function equals(version: Version
) → Boolean
Returns true if the receiving Version
is equal to the argument Version
.
function atLeast(version: Version
) → Boolean
Returns true if the receiving Version
is at the same as or newer than the argument Version
.
function isAfter(version: Version
) → Boolean
Returns true if the receiving Version
is strictly after the argument Version
.
function isBefore(version: Version
) → Boolean
Returns true if the receiving Version
is strictly before the argument Version
.
var versionString
→ String
read-onlyReturns as an opaque string representation of the Version
, suitable for display or logging. This should never be used in comparisons of any sort.
Window
An OmniPlan window.
var selection
→ Selection
read-onlyCurrent selection in this window.