Skip navigation
Currently Being Moderated

Quit InDesign and open Illustrator

Aug 5, 2012 11:13 PM

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...

 
Replies
  • Currently Being Moderated
    Aug 6, 2012 4:10 AM   in reply to piggychops

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 3:07 AM   in reply to -hans-

    nice. and how to use bridge talk to open illustrator documents

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 4:06 AM   in reply to bala281972

    shows also how to pass arguments ...

     

    but, sorry:

    balasoundiram wrote:

     

    nice. and how to use bridge talk to open illustrator documents

    is this a question or a statement¿

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 4:17 AM   in reply to -hans-

    its a question. would like to open an eps file and export it as an svg format, i've tried illustrator.open(File ('bala.eps')); but unable to export it as svg

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 5:25 AM   in reply to bala281972

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 6:55 AM   in reply to bala281972

    Why are you having ID send AI bridgetalk messaging to do this? I don't see your point?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 7:03 AM   in reply to Muppet Mark

    well, the flow is like this, indesign will export an eps file and illustrator will open that eps file and save it as svg

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 7:09 AM   in reply to bala281972

    Well that makes sence now… although I perfer *.pdf over *.eps

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 7:21 AM   in reply to Muppet Mark

    it doesnt matter as the final output is going to be in svg

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 8:03 AM   in reply to bala281972

    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)

        }

     

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 9:01 AM   in reply to -hans-

    doesn't work?

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 8:21 PM   in reply to -hans-

    no, it doesnt work

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 13, 2012 11:41 PM   in reply to bala281972

    Hi,

     

    balasoundiram wrote:

     

    no, it doesnt work

    my above posted code (which works on my machines!¿ mac / win) or your approach? ... and are you still looking for a solution?

     

    Have a nice day

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 14, 2012 12:17 AM   in reply to -hans-

    unfortunately it doesnt work for me and still looking out for a solution. I couldnt solve it on my own as my knowledge on bridge is limited.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points