Skip to main content
Inspiring
February 25, 2019
Answered

CEP illustrator run js file

  • February 25, 2019
  • 2 replies
  • 3190 views

Currently I have a script that I wrote which runs when I go to

File -> Scripts -> Other Script...

I then select my script it opens and runs.

To maximize the efficiency and eliminating the selection of the script each time, I went and added it to the CEP Html Extensions panel.

Here I set it up so when you click a button it would run the script.  However it isn't working.

I tested it in Chrome and verified the script is there but it doesn't run.  I only tested to ensure the script was there and being selected in chrome.  I didn't actually expect it to open illustrator file from there. 

The basic script opens up a file in illustrator and places some text on the file.

Am I missing something as to how a script can be executed from CEP?

This topic has been closed for replies.
Correct answer Ten A

You can use the evalScript method in the CSInterface class.

typical usage is below...

var csi = new CSInterface();

csi.evalScript("<ExtendScript Function Name>()");

Can you show your CEP side JavaScript code?

*This thread moved from Illustrator Scripting forum to Extensions/Add-ons Deveropment forum.

2 replies

tomzag
Inspiring
February 26, 2019

Another way to call it from the *.jsx file:

function runCustomScript(path) {

    var scriptFile = new File(path);

    var script = '#include' + scriptFile;

    try {

        eval(script);

    } catch (e) {

        alert(e);

    }

}

Ten A
Community Expert
Ten ACommunity ExpertCorrect answer
Community Expert
February 25, 2019

You can use the evalScript method in the CSInterface class.

typical usage is below...

var csi = new CSInterface();

csi.evalScript("<ExtendScript Function Name>()");

Can you show your CEP side JavaScript code?

*This thread moved from Illustrator Scripting forum to Extensions/Add-ons Deveropment forum.

OhmsGAuthor
Inspiring
February 25, 2019

I'm using the standard code that came with the cep test package. 

Found here: 

https://github.com/Adobe-CEP/CEP-Resources/blob/master/CEP_9.x/Samples/CEP_HTML_Test_Extension-9.0/html/Nodejs.html

On this page is where I'm adding my code in between script tags.