Cacidi LiveMerge CC Manual

Custom Data Source

The following is an exampling on how a Custom Data query could look like written in JavaScript. Using the Custom option as data source in the Project Settings window, data can be imported into Cacidi LiveMerge and manipulated in any number of ways be means of such a script.

//Get the scripting Arguments of the Application
args = app.scriptArgs;
//DataQuery, GroupContents and CroupUsingListField
//applies to the options available in an ordinary Project setting
//using a standard Data Source
var DataQuery = args.get(DataQuery);
var GroupContens = args.get(GroupContens);
var GroupUsingListField = args.get(GroupUsingListField);
//Declare variables to start reading a text file
//This portion could be changed to read from an Excel file,
//a Oracle database or whatever format the Data Source might
//have as long as the Header and Data Body is returned to
//the Cacidi plugin
var startPath=Macintosh HD:;
var mFileName=startPath+BikeData+.txt;
var mFile=new File(mFileName);
var myResult = mFile.open(r, undefined, undefined);
//read the text file
var Data=mFile.read();
//Split the data into a header line and data body
//Note the format of the header, which is separated by
//carriage returns
var dataLines=Data.split (chr(10));
var headerData=dataLines[0];
headerData=headerData.replace(/ /g,
);
var productionData=;
//Manipulate the data body in any desired way
for (i=1; i{
productionData=productionData+dataLines[i]+
;
}
//Return the manipulated data and header to
//Cacidi Extreme or Cacidi LiveMerge
args.setValue(HeaderData,headerData);
args.setValue(ProductionData,productionData);


Leave a Reply

The Number One Plugin developer for Adobe InDesign