How to quit InDesign and open Illustrator using Indesign javascripting?
Here is my code:
//Quit Indesign
myDocument.close ( SaveOptions.NO );
//OPEN IN ILLUSTRATOR
#target illustrator
app.documents.add(DocumentColorSpace.CMYK, width = 1024, height = 768);
But in this code the script will perform only illustrator operations... It wont quit the indesign file...
Can any one help me...
Hi,
you've got to use bridgetalk.
#target indesign
main();
function main() {
if ( app.documents.length == 0 ) { return; }
app.activeDocument.close(SaveOptions.NO )
callFunction = doIlluStuff;
callFunction += '\rdoIlluStuff(500 , 500);';
btMessaging( 'illustrator', callFunction );
}
function btMessaging( target, callFunction ) {
var bt = new BridgeTalk();
bt.target = target;
bt.body = callFunction;
bt.send();
}
function doIlluStuff(w,h) {
app.documents.add(DocumentColorSpace.CMYK, width = w, height = h);
}
Documentation is within JavaScriptToolsGuide.
var myFile = "~/Desktop/Untitled-1.eps";
var svgFile = "~/Desktop/Untitled-2.svg";
var et = "ExportType.SVG";
var x=","
var bt = new BridgeTalk;
bt.target = 'illustrator';
bt.body = "app.open (File" + myFile.toSource() + ");";
bt.body=bt.body+"app.activeDocument.exportFile(new File("+myFile.toSource()+")"+x.toSource()+et.toSource()+");";
bt.onResult = function(resObj) {
var myResult1 = resObj.body;
$.writeln("myResult1 = " + myResult1);
return myResult1;
}
bt.send();
this doesnt work, some minor syntax error, i couldn't sort it out
Hi,
to simplify the notation e.G. passing arguments through bridgetalk I like to do it like this:
//store all your arguments in a array
var myArgumentsAsArray = [File('~/Desktop/test.eps'), File('~/Desktop/Untitled-2.svg')];
script = myIlluScript;
//coercing to source only this array, nothing else | ->work with calling functions
script += '\myIlluScript(' + myArgumentsAsArray.toSource()+ ');';
btMessaging( 'illustrator', script );
function btMessaging( targetApp, script ) {
BridgeTalk.bringToFront( 'illustrator' );
var bt = new BridgeTalk();
bt.target = targetApp;
bt.body = script;
bt.send();
}
//get the arrayparts
function myIlluScript(aArray){
app.open(aArray[0]);
app.activeDocument.exportFile(aArray[1], ExportType.SVG)
}
North America
Europe, Middle East and Africa
Asia Pacific