This section describes how to work with the application in general. The following topics are covered:

Detecting the application's version

When working with functionality in the application that was introduced in a specific version of After Effects (for example, shape layers in CS3), you will want to detect the application's version number before scripting the functionality. That way, if the script is not running in a capable version of After Effects, your script can provide an appropriate error message or fallback behavior.

The following code shows how to show an error message if the Afer Effects version is older than what is required.

// given:
// app = Application object representing After Effects
if (parseFloat(app.version) < 8.0));             // CS3 is version 8.0
    alert("This script requires After Effects CS3 or later.");
    // minimun version is satisfied...carry on

Note: Using parseFloat() on the app.version attribute's string value returns the major and minor numbers but not the dot-release number or build number. So, an app.version value of "11.0.2x12" will return 11, and a value of "10.5x3" will return 10.5. This level of granularity should be enough to detect feature changes in major and minor versions, but usually not in smaller bug fix releases.