admin管理员组文章数量:1410705
I’m trying to create a test CEP plug-in for Adobe Illustrator 2025, but I’m facing difficulties at the initial stage. The main issues are:
The plug-in works only once after launch. After that, it stops responding to further calls.
I don’t know how to debug the plug-in. For example, is there any console or debugging tools that can help identify issues?
I tried using location.reload()
to refresh the plug-in after code changes, but it doesn’t work properly.
I created a test plug-in, signed it with a certificate, and connected it to Illustrator. The plug-in appeared in the Windows > Extensions > myPlugInTEST menu.
To test the plug-in’s functionality, I added a simple code in main.jsx
that creates a rectangle and a text element in the Illustrator document. This code worked, but only once.
For interaction between the HTML interface and JSX, I used CSInterface.js
.
I added a button in HTML that triggers the JSX script via evalScript()
.
To refresh the plug-in after code changes, I used location.reload()
, but it didn’t work as expected.
Example of My Code:
File index.html
:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>AutomationDScode</title>
<link rel="stylesheet" href="./css/styles.css">
</head>
<body>
<h1>Hello, Illustrator!</h1>
<button id="run-script">Click here!</button>
<script>
function addContextMenu() {
const csInterface = new CSInterface();
csInterface.setPanelFlyoutMenu("Refresh Panel");
csInterface.addEventListener("com.adobe.csxs.events.flyoutMenuClicked", (event) => {
if (event.data.menuName === "Refresh Panel") {
location.reload();
}
});
}
addContextMenu();
</script>
<script src="./js/libs/CSInterface.js"></script>
<script src="./js/main.js"></script>
</body>
</html>
File main.jsx
:
if (app.documents.length === 0) {
var doc = app.documents.add();
} else {
var doc = app.activeDocument;
}
var rect = doc.pathItems.rectangle(200, 200, 100, 100);
var textFrame = doc.textFrames.add();
textFrame.contents = "Hello, Adobe Illustrator!";
textFrame.position = [100, 500];
alert("Done!");
File main.js
:
import csInterface from "./libs/CSInterface";
document.getElementById("run-script").addEventListener("click", () => {
const csInterface = new CSInterface();
csInterface.evalScript('$.evalFile("/jsx/main.jsx");');
location.reload();
});
Separate Issue: Plug-In Refresh
I tried using location.reload()
to refresh the plug-in after code changes, but it doesn’t work. The plug-in doesn’t update, and I can’t see the changes I make to the code.
本文标签: pluginsCEP PlugIn for Illustrator 2025 Debugging and Reloading ChallengesStack Overflow
版权声明:本文标题:plugins - CEP Plug-In for Illustrator 2025: Debugging and Reloading Challenges - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745010987a2637551.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论