All functions of MochaImport+ V6 can also be remote-executed from other scripts. It supports exactly the same functions as the build-in KBar-API, so please refer to the KBar API documentation for the documentation of all available functions.

Using the API is best explained with an example:

This document explains how to remote-execute functions of MochaImport+ V6
from other Ae scripts.

The API object used here has the same functions as the KBar API

// let's get the API to do something with MochaImport+.
// Pass a file object to MochaImportPlus.jsxbin as argument
// of the getMochaImportPlusV6() call
// if it is not in the same folder as this script.
// See definition of this function at the end of this file
var API = getMochaImportPlusV6();

// loads tracking data from the mocha effect on the selected layer

// applies a corner pin to the selected layer
// a dialog is shown to choose the corner pin options

// applies a corner pin to the first layer of the active comp

// applies a corner pin to the second layer of the composition without showing a dialog
	silent:true, // no dialog, so we have to specify all options below or default values are used
	cornerPinEffect:"CC Power Pin", // this is the effect match name of the

This function creates the mochaImportPlusV6 object if it does not exist yet

If scriptFile is undefined, this function assumes that MochaImportPlus.jsxbin is
in the same folder as this script file. Otherwise, please pass a file object
for MochaImportPlus.jsxbin as scriptfile argument.

function getMochaImportPlusV6(scriptFile){
	if(typeof mochaImportPlusV6 == 'undefined'){
		return executeMochaImportPlus(scriptFile);
	return mochaImportPlusV6;

	function executeMochaImportPlus(scriptFile){
		if(scriptFile === undefined){
			scriptFile = getMochaImportPlusScriptFileFromDefaultLocation();
		if(!scriptFile.exists) throw new Error("could not find file "+scriptFile.fsName);"r");
		var fileContents =;

		// yes, this is a global variable.
		// we use this kbar API to tell MochaImport+ that it should not show its user interface
		// and return its API instead
		kbar = { button:{argument:"getAPI"}};
		// execute the file --> this should create the mochaImportPlusV6 object
		var result = eval(fileContents);

		// when MochaImport+ understands the button command, it will set it to undefined.
		if(kbar.button !== undefined){
			throw new Error("MochaImport+ didn't understand the getAPI action, is scriptFile pointing to another script?");
		return result;

	function getMochaImportPlusScriptFileFromDefaultLocation(){
		// get the folder where this script file is located
		var myFolder = (new File($.fileName)).parent;
		// find MochaImportPlus.jsxbin in the same folder
		var scriptFile = new File(myFolder.fsName+"/MochaImportPlus.jsxbin");
		return scriptFile;

What about licenses?

Of course, the API will only work if a proper MochaImport+ license is installed. If you run in trial mode, the usual trial limitations apply (only the first few frames of tracking data are loaded).