the Application Programming Interface (API)
See also: Exploring the API with Excel, The Script Editor
LEAP can act as a standard "COM Automation Server," meaning that other Windows programs can control LEAP directly: changing data values, calculating results, and exporting them to Excel or other applications. The API even provides functions for examining or changing LEAP's data structures This ability to program LEAP can be very powerful. For example, you could write a short script that could run LEAP calculations many times, each time with a different set of input assumption. LEAP's results could then be output to Excel or processed in the script and used to calculate revised assumptions for subsequent LEAP calculations. In this way LEAP's basic accounting calculations could be coupled with more sophisticated algorithms such as goal-seeking or optimizing algorithms.
The LEAP Application Programming Interface (API) consists of several "classes," each with their own "properties" and "methods." Properties are values that can be inspected or changed, whereas methods are functions can be called do something.
The following classes are defined in LEAP's API:
-
LEAPApplication: top-level properties and methods, including access to all other classes.
-
LEAPArea: a LEAP area.
LEAPAreas: collection of all LEAP areas. -
LEAPBranch: a specific branch on the data tree (e.g., \Demand\Household\Urban).
LEAPBranches: a collection of all the child branches for a specified branch (e.g., Branch("\Demand").Children ). -
LEAPFavorite: a named favorite result chart.
LEAPFavorites: the collection of all favorites in the active area. -
LEAPFuel: a specific fuel in the active area.
LEAPFuels: the collection of all fuels in the active area. -
LEAPRegion: a specific region in the active area.
LEAPRegions: the collection of all regions in the active area. -
LEAPScenario: a scenario in the active area.
LEAPScenarios: the collection of all scenarios in the active area. -
LEAPUnit: a specific unit region in the active area.
LEAPUnits: the collection of all units in the active area. -
LEAPVariable: a Variable for a given Branch (e.g., "Activity Level" for Branch \Demand\Households\Urban).
LEAPVariables: collection of all Variables for a single Branch (e.g., all variables for \Demand\Households\Urban). -
LEAPView: a view of the LEAP area.
LEAPViews: a collection of all views.
LEAP has its own built-in script editor that can be used to edit, interactively debug and run scripts that automate LEAP using its API. LEAP uses Microsoft's Windows Script (aka ActiveScript) technology and directly supports scripts written in VBScript. Some other web-based resources you may find useful: