Include

include(<string> Script Name)

include(<string> Script Name, <string> Script Name 2,…<string> Script Name n)

This function will include a script that is already written into the execution of the current script.  Once this call is made, the functions (Calculate, Validate, etc) within the included script can be accessed from the current script.  The parameters of the included script can also be set from the current script.  You may include Delsys-provided scripts, or create your own files containing commonly used utility functions and include them.  Include searches for scripts in the user-defined script location (as set in Tools->Options) as well as the path for scripts installed with EMGworks, if the script path does not specify a full path. To include files in other locations, specify the full path to the file to include.

Include can take a list of scripts as arguments, separated by comments.

Example:

This example demonstrates how to include a script in another script:

/**

* Include Example

* @name Include Example

* @version 1.0.0.0

* @author Delsys Inc

* @signed 5cc9115f1d638486330a65c251fd83ccf8b4b691

* @namespace INC

*/

 

INC = {

Calculate: function ()

{

       include(“Sliding Window Root Mean Square.emjs”);       //script located in designated folder

       RMS.Parameter = {};  //need to instantiate the Parameter object for RMS script

       //Assign or link all parameters from included script

       RMS.Parameter.WindowUnit = 0;    

       RMS.Parameter.WindowLength = INC.Parameter.WindowLength;

       RMS.Parameter.WindowOverlap = INC.Parameter.WindowOverlap;

       RMS.Parameter.ZeroPad = false;

       RMS.Parameter.RemoveOffset = false;

       RMS.Input = INC.Input;     //link inputs

       RMS.Output = {};           //need to instantiate the Output object for RMS script

 

       RMS.Calculate();           //call calculate function of included script

 

       INC.Output.Data = RMS.Output.RMS;//link outputs

}

 

 

Input: 0,

 

OutputTemplate:

{

       Data: {seq: 1, name: “Include Example Data”},

},

 

Validate: function()

{

       if(INC.Parameter.WindowLength < INC.Parameter.Overlap)

              return “Window Length must be greater than Window Overlap”;

},

 

ParameterTemplate:

{

       WindowLength: {seq: 1, name: “Window Length”, type: “number”, initial: .125},

       WindowOverlap: {seq: 2, name: “Window Overlap, type: “number”, initial: .0625},

},

}