Where speed and enhanced integration needs to be achieved then the c++ interface is probably the best route as we used in the integration of Illustrator into SMART boards
CEP is the standard way of providing a user interface and uses web based technologies such as HTML and JavaScript. Event handling can be provided you with the C++ and extend script interfaces for both commands and feedback.
CEP and ExtendScript are two distinct technologies that cannot coexist in the same source file. CEP and ExtendScript operate in distinct environments, with distinct APIs and use cases. ExtendScript is typically used for back-end automation and batch processing that runs in the context of a specific Adobe application, so although CEP is typically used to create custom UI elements and front-end functionality that runs in a browser-like environment. ExtendScript code cannot be included in the same code within a CEP extension other than just as a text string, nor can CEP code be run within an ExtendScript script. If you want to use both CEP and ExtendScript in your project, you should ideally use two source files , one for CEP and one for ExtendScript.
You can use the evalScript method provided by the CEP extension APIs to call ExtendScript from a CEP extension. This method allows you to run ExtendScript code within the Adobe application in which the CEP extension is running. Here's an example of how the evalScript method can be used to run an ExtendScript script from the JavaScript in a CEP extension with the code being passed as a string:
var csInterface = new CSInterface();
function callExtendScript() {
var script = "var doc = app.activeDocument; doc.artboards[0].name = 'New Name';";
csInterface.evalScript(script, function(result) {
console.log(result);
});
}
In this case, the evalScript method is invoked with the ExtendScript script as its first argument. The second argument is a callback function that is invoked once the script has completed its execution. This callback function accepts a single parameter, which contains the script's output. It's important to note that the evalScript method is synchronous, which means it will halt the CEP extension execution until the ExtendScript script has completed. If your script takes a long time to execute, the user interface will become unresponsive.
This is the folder structure of a typical CEP extension:
MyExtension/
CSXS/
manifest.xml
js/
index.js
myScript.js
html/
index.html
css/
styles.css
assets/
logo.png
myScript.jsx
Do you want to discuss an Illustrator Development project with us? Fill out our form and one of our experts will contact you to get the process started....
Contact Us