• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to open a graphics images in illustrator via InDesign using javascript

Participant ,
Oct 23, 2020 Oct 23, 2020

Copy link to clipboard

Copied

Need to open a graphics images in ilustrator, which that used in indesign

Please share javascript code with explanation its more helpful to understand.

 

Thanks

Balaji

TOPICS
Activation billing and install , Feature request , How to , Import and export , InCopy workflow , Performance , Scripting , SDK , Sync and storage , Type

Views

183

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2020 Oct 23, 2020

Copy link to clipboard

Copied

Possible help here:

https://forums.adobe.com/message/10598534#10598534

Mike Witherell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 23, 2020 Oct 23, 2020

Copy link to clipboard

Copied

LATEST

You would need to use the BridgeTalk class to open other applications.

http://estk.aenhancers.com/interapplication-communication/communicating-through-messages.html

 

I posted a Photoshop example here:

 

https://community.adobe.com/t5/indesign/indesign-script-for-get-color-name-or-values-of-illustrator-...

 

Here is a similar example for Illustrator. Direct Select a linked AI file and run the script. It sends the link’s file path to Illustrator, opens the linked file and returns a string back to ID:

 

 

 

//InDesign as the script application
#target indesign
#targetengine "session" 

//the file path of a selected placed AI file
var fp = app.activeDocument.selection[0].itemLink.filePath;

runIllustrator(true, "Hey There");


/**
* A BridgeTalk function to run in Illustrator 
*  a boolean example 
*  a string example 
*  void 
* 
*/
function runIllustrator(isBoolean, theString){
    //open Photoshop and run psScript
    var bt = new BridgeTalk();  
    bt.target = "Illustrator";  
    //the function string with a string variable and 2 parameters
    //Note a string parameter is '"+theString+"'
    //Other parameters are "+isBoolean+"
    
    bt.body = "var aString = '"+fp+"'; var func = " + aiScript.toString() + "func("+isBoolean+",'"+theString+"');";

    bt.onResult = function(resObj) { 
        alert("Illustrator returned this message: " + resObj.body);
    }  
    bt.onError = function( inBT ) { alert(inBT.body); };  
    bt.send(8);  
      
    function aiScript(isBoolean, theString) {  
        app.open(File(aString));
        var n = app.documents[0].name
        alert("Illustrator Running. Document named " + n + " is open.")
        
        //the 2 parameters and variable with the file path sent to Illustrator
        $.writeln("1st Param= " + isBoolean); 
        $.writeln("2nd Param= " + theString);
        $.writeln("1st Var= " + aString);
        return "Done"
    }  
}

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines