Skip to main content
benbrownMOTIONS
Participant
January 19, 2020
Answered

Create jsx file?

  • January 19, 2020
  • 4 replies
  • 37125 views

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?

Correct answer Inventsable

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

4 replies

Participant
February 18, 2025

(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();
})();

Participant
January 9, 2024

<>
// Get the active composition var comp = app.project.activeItem; // Check if a
composition is open if(comp != null &amp;&amp; comp instanceof CompItem){"{"}
// Check if the square layer exists var squareLayer = comp.layer("Square");
if(squareLayer != null &amp;&amp; squareLayer instanceof AVLayer &amp;&amp;
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.");
{"}"}
</>

Participant
September 17, 2021

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)

FuturePublishing
Participant
October 20, 2022

Genius! @twiceav 

Inventsable
InventsableCorrect answer
Legend
January 19, 2020

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

Inventsable
Legend
January 19, 2020

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

patd61312907
Inspiring
May 5, 2021

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...