Files
awesome-copilot/skills/adobe-illustrator-scripting/scripts/find-replace-text.jsx
John Haugabook 2a8de795ca new skill adobe-illustrator-scripting (#1448)
* new skill adobe-illustrator-scripting

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-28 13:37:06 +10:00

33 lines
893 B
JavaScript

// find-replace-text.jsx
// Finds and replaces text across all text frames in the active document.
// Usage: Run from File > Scripts > Other Scripts in Adobe Illustrator.
#target illustrator
(function () {
if (app.documents.length === 0) {
alert("No document is open.");
return;
}
var doc = app.activeDocument;
var findStr = prompt("Find text:", "");
if (findStr === null || findStr === "") return;
var replaceStr = prompt("Replace with:", "");
if (replaceStr === null) return;
var count = 0;
for (var i = 0; i < doc.textFrames.length; i++) {
var tf = doc.textFrames[i];
var original = tf.contents;
if (original.indexOf(findStr) !== -1) {
tf.contents = original.split(findStr).join(replaceStr);
count++;
}
}
alert("Replaced text in " + count + " text frame(s).");
})();