Copy link to clipboard
Copied
Im trying to create a jsx file. I thought you did this out of the Adobe Extendscript Toolkit, which appears to no longer be available in the app manager. I changed the preferences to show older apps, still isnt showing up. Does anyone know what the issue is? Is there another way to create a jsx file?
1 Correct answer
Hi, a .jsx file is just a text file with the extension ".jsx". You can use any program to create them (or manually rename any file into .jsx) and any text editor to write your code without ever touching the ESTK. That said, I'd recommend VSCode since it's amazing as a source code editor, free and open source from Microsoft, and Adobe has moved ESTK support to VSCode
Copy link to clipboard
Copied
Hi, a .jsx file is just a text file with the extension ".jsx". You can use any program to create them (or manually rename any file into .jsx) and any text editor to write your code without ever touching the ESTK. That said, I'd recommend VSCode since it's amazing as a source code editor, free and open source from Microsoft, and Adobe has moved ESTK support to VSCode
Copy link to clipboard
Copied
If you want a sample of how VSCode feels, here's a sandbox browser version setup for After Effects scripting. Try typing app and a period, then press the info icon in the popup menu to expand and see the intellisense for the app DOM.
Also mandatory plug for Adobe Script Runner from renderTom so you can launch scripts from VSCode as you type them
Copy link to clipboard
Copied
Hi All,
I tried creating scripts for both versions and they worked I used Text Edit, saved as jsx, added the script toAI scripts, and was able to see the script in Adobe Illustrator upon relaunching.
Is it possible that it will no longer work for the later versions of AI? I am currently using AI 2021 25.2.3.
I receive the below error message:
I removed the .rtf extension and replaced it with .jsx, is this correct?
Perhaps I am missing something...
Copy link to clipboard
Copied
Hi, you are indeed missing something.
You are changing the file format to .jsx and that is fine, but the error you are getting happens because the file does not comply with UTF-8 (character encoding).
To fix it, if you are using the "TextEdit" from mac, you should go to:
TextEdit -> Preferences -> Plain Text
Now, you can save the file in Unicode (UTF-8), then, change the file extension to .jsx just like you did before.
Copy link to clipboard
Copied
hey, got the same error message, after changing the text to plain text.
any help?
Copy link to clipboard
Copied
Hi, I had this issue to and I was able to resolve it. Make sure when you save to plain text that you add .js to the end of the filename. Format is [yourfilename].js
This should work.
Copy link to clipboard
Copied
Copy an existing .jsx file from the folder Apps/Adobe Illustrator 2021/Scripting, replace the content with the suggested code and save it. After that, I was able to load the script into Illustrator.
When I created a totally new jsx file, I also got the error message (syntax error)
Copy link to clipboard
Copied
Genius! @twiceav
Copy link to clipboard
Copied
<>
// Get the active composition var comp = app.project.activeItem; // Check if a
composition is open if(comp != null && comp instanceof CompItem){"{"}
// Check if the square layer exists var squareLayer = comp.layer("Square");
if(squareLayer != null && squareLayer instanceof AVLayer &&
squareLayer.source instanceof SolidSource){"{"}
// Set keyframes for scale and color over 15 frames var duration = 15; var
endTime = squareLayer.startTime + duration; // Set keyframes for scale
squareLayer.property("Scale").setValuesAtTimes([squareLayer.startTime,
endTime], [[100, 100], [0, 0]]); // Set keyframes for color
squareLayer.property("ADBE Color
Control-0001").setValuesAtTimes([squareLayer.startTime, endTime], [[1, 1, 1],
[1, 1, 0]]);
{"}"} else {"{"}
alert("Square layer not found or is not a solid layer.");
{"}"}
{"}"} else {"{"}
alert("No active composition found.");
{"}"}
</>
Copy link to clipboard
Copied
(function moveOnProximity() {
var comp = app.project.activeItem;
if (!comp || !(comp instanceof CompItem)) {
alert("Please select a composition.");
return;
}
var layers = comp.selectedLayers;
if (layers.length < 2) {
alert("Select at least two layers (one leader and others to be affected).");
return;
}
var leader = layers[0]; // The first selected layer is the leader
var others = layers.slice(1);
app.beginUndoGroup("Proximity Movement");
for (var i = 0; i < others.length; i++) {
var layer = others[i];
// Add expression to the position property
var expr = `
leader = thisComp.layer("${leader.name}");
leaderPos = leader.position;
myPos = position;
threshold = 150; // Distance at which movement happens
force = 50; // How much the object moves
dist = length(leaderPos, myPos);
if (dist < threshold) {
moveDir = normalize(myPos - leaderPos);
myPos + moveDir * force * (1 - dist / threshold);
} else {
myPos;
}
`;
layer.property("Position").expression = expr;
}
app.endUndoGroup();
})();

