ExtendScript (JavaScript/JSX)를 사용하여 문서, 레이어, 패스를 조작하는 Adobe Illustrator 자동화 스크립트를 작성, 디버깅 및 최적화합니다.
- GitHub 스타
- 41,038
- 파일
- 5
- 마지막 커밋
- 2026년 11월 11일
- 라이선스
- MIT
- 허용된 도구
- —
adobe-illustrator-scripting skill은 무엇을 하나요?
adobe-illustrator-scripting은(는) agent skill입니다. ExtendScript (JavaScript/JSX)를 사용하여 문서, 레이어, 패스를 조작하는 Adobe Illustrator 자동화 스크립트를 작성, 디버깅 및 최적화합니다.
skill의 SKILL.md에서 생성된 요약입니다.
adobe-illustrator-scripting skill 정보
이 SKILL은 개발자와 디자이너가 ExtendScript를 통해 Adobe Illustrator 작업을 자동화할 수 있도록 지원합니다. Illustrator DOM과 직접 상호작용하는 JavaScript 기반 자동화 스크립트를 작성, 디버깅 및 최적화하는 데 필요한 전문 지식을 제공합니다. 이 SKILL을 로드하면 에이전트가 문서 조작, 레이어 관리 및 패스 생성을 포함한 복잡한 워크플로우 구축을 도울 수 있습니다.
사용자는 파일 일괄 처리나 PDF, SVG, PNG와 같은 형식으로 아트워크를 내보내는 반복적인 작업을 처리하기 위해 프로덕션 품질의 .jsx 파일을 생성할 수 있습니다. 이 SKILL은 PathItem, TextFrame, Artboard와 같은 특정 객체를 포함하여 전체 객체 모델을 다룹니다. 또한 포인트를 사용한 좌표계 관리, CMYK 및 RGB와 같은 다양한 색상 모델 처리, 텍스트 속성 서식 지정에 대한 가이드를 제공합니다. 데이터 기반 그래픽을 구축하든 인쇄 워크플로우를 자동화하든, 이 SKILL은 애플리케이션을 프로그래밍 방식으로 제어하기 위한 기술 가이드 역할을 합니다.
agent가 수행할 수 있는 작업
- 1문서 내보내기 자동화스크립트 기반 내보내기 옵션을 사용하여 단일 Illustrator 문서에서 여러 파일 형식을 생성합니다.
- 2아트워크 일괄 처리대량의 Illustrator 파일에 대해 일관된 변경 사항이나 변형을 적용합니다.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
adobe-illustrator-scripting skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.Claude Code에 adobe-illustrator-scripting skill 설치
~/.claude/skills/adobe-illustrator-scripting/SKILL.md
$ npx degit github/awesome-copilot/skills/adobe-illustrator-scripting ~/.claude/skills/adobe-illustrator-scriptingClaude Code (project)에 adobe-illustrator-scripting skill 설치
.claude/skills/adobe-illustrator-scripting/SKILL.md
$ npx degit github/awesome-copilot/skills/adobe-illustrator-scripting .claude/skills/adobe-illustrator-scriptingCodex에 adobe-illustrator-scripting skill 설치
~/.agents/skills/adobe-illustrator-scripting/SKILL.md
$ npx degit github/awesome-copilot/skills/adobe-illustrator-scripting ~/.agents/skills/adobe-illustrator-scriptingGemini CLI에 adobe-illustrator-scripting skill 설치
~/.gemini/skills/adobe-illustrator-scripting/SKILL.md
$ npx degit github/awesome-copilot/skills/adobe-illustrator-scripting ~/.gemini/skills/adobe-illustrator-scriptingClaude.ai에 adobe-illustrator-scripting skill 설치
npx degit github/awesome-copilot/skills/adobe-illustrator-scripting adobe-illustrator-scripting && zip -r adobe-illustrator-scripting.zip adobe-illustrator-scripting # claude.ai → Customize → Skills → + → Create skill → Upload a skill → adobe-illustrator-scripting.zip
자동 검사
2026년 11월 15일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 보안 감사는 아닙니다. 에이전트가 실행하기 전에 스크립트를 읽어 보세요. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능github/awesome-copilot/skills/adobe-illustrator-scripting is public and reachablegithub.com/github/awesome-copilot/tree/HEAD/skills/adobe-ill ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit 2026-11-11github.com/github/awesome-copilot/commits ↗통과
- 스크립트에 다운로드 후 실행이나 자격 증명 탈취가 없음No scripts in the skill folder통과
- SKILL.md에 숨겨진 지침 없음No override phrases, safeguard switches, credential requests or hidden charactersgithub.com/github/awesome-copilot/blob/HEAD/skills/adobe-ill ↗통과
- 사전 허용 도구가 제한됨No pre-approved tools; the agent asks before using onegithub.com/github/awesome-copilot/blob/HEAD/skills/adobe-ill ↗통과
- SKILL.md가 Agent Skills 형식을 따름SKILL.md is 1024 lines; the spec suggests under 500github.com/github/awesome-copilot/blob/HEAD/skills/adobe-ill ↗결함 발견
SKILL.md
GitHub에서 보기Adobe Illustrator Scripting
Expert guidance for automating Adobe Illustrator through ExtendScript (JavaScript/JSX). This skill covers the Illustrator scripting object model, all major API objects, code patterns, and best practices for writing production-quality .jsx scripts.
Bundled Assets
references/object-model-quick-reference.md: Use this as a quick lookup for the Illustrator scripting object model, common document and page item types, and related DOM concepts while writing or debugging scripts.scripts/: Contains example Illustrator automation scripts you can use as starting points or implementation patterns for common tasks such as document manipulation, exports, batch processing, and DOM usage. Review and adapt these examples when you need working JSX patterns or want to compare behavior while debugging.
When to Use This Skill
- Writing new Illustrator automation scripts (
.jsxor.jsfiles) - Debugging or fixing existing Illustrator ExtendScript code
- Manipulating documents, layers, page items, paths, text, or colors programmatically
- Batch-processing Illustrator files or generating artwork from data
- Exporting documents to various formats (PDF, SVG, PNG, EPS, etc.)
- Working with the Illustrator DOM (Application, Document, Layer, PathItem, TextFrame, etc.)
- Creating data-driven graphics using variables and datasets
- Automating print workflows with scripted print options
Prerequisites
- Adobe Illustrator CC or later installed
- Basic JavaScript knowledge (ExtendScript is ES3-based with Adobe extensions)
- Scripts are executed via File > Scripts > Other Scripts, the Scripts menu, or placed in the Startup Scripts folder
- The ExtendScript Toolkit (ESTK) or any text editor can be used to write
.jsxfiles
Scripting Environment
Language and File Extensions
| Language | Extension | Platform |
|---|---|---|
| ExtendScript/JavaScript | .jsx, .js |
Windows, macOS |
| AppleScript | .scpt |
macOS only |
| VBScript | .vbs |
Windows only |
This skill focuses on ExtendScript/JavaScript as the cross-platform, most widely used option.
Executing Scripts
- Scripts menu: File > Scripts lists scripts from the application scripts folder
- Other Scripts: File > Scripts > Other Scripts to browse and run any
.jsxfile - Startup Scripts: Place scripts in the Startup Scripts folder to run automatically on launch
- Target directive: Begin scripts with
#target illustratorwhen running from ESTK or external tools #targetenginedirective: Use#targetengine "session"to persist variables across script executions- External invocation: Scripts are frequently launched from outside Illustrator — by shell scripts, task runners, CI jobs, ExtendScript Toolkit (
ExtendScript Toolkit.exe -run script.jsx), orBridgeTalkmessages from other Adobe apps. See External Invocation & Argument Passing.
Naming Conventions (JavaScript)
- Objects and properties use camelCase:
activeDocument,pathItems,textFrames - The
appglobal references theApplicationobject - Collection indices are zero-based:
documents[0]is the frontmost document - Use
typenameproperty to identify object types at runtime
Object Model Overview
The Illustrator DOM follows a strict containment hierarchy:
Application (app)
├── activeDocument / documents[]
│ ├── layers[]
│ │ ├── pageItems[] (all artwork)
│ │ ├── pathItems[]
│ │ ├── compoundPathItems[]
│ │ ├── textFrames[]
│ │ ├── placedItems[]
│ │ ├── rasterItems[]
│ │ ├── meshItems[]
│ │ ├── pluginItems[]
│ │ ├── graphItems[]
│ │ ├── symbolItems[]
│ │ ├── nonNativeItems[]
│ │ ├── legacyTextItems[]
│ │ └── groupItems[]
│ ├── artboards[]
│ ├── views[]
│ ├── selection (array of selected items)
│ ├── swatches[], spots[], gradients[], patterns[]
│ ├── graphicStyles[], brushes[], symbols[]
│ ├── textFonts[] (via app.textFonts)
│ ├── stories[], characterStyles[], paragraphStyles[]
│ ├── variables[], datasets[]
│ └── inkList[], printOptions
├── preferences
├── printerList[]
└── textFonts[]
Top-Level Objects
- Application (
app): The root object. Provides access to documents, preferences, fonts, and printers. Key properties:activeDocument,documents,textFonts,printerList,userInteractionLevel,version. - Document: Represents an open
.aifile. Key properties:layers,pageItems,selection,activeLayer,width,height,rulerOrigin,documentColorSpace. Key methods:saveAs(),exportFile(),close(),print(). - Layer: A drawing layer. Key properties:
pageItems,pathItems,textFrames,visible,locked,opacity,name,zOrderPosition,color.
Measurement Units and Coordinates
Units
All scripting API values use points (72 points = 1 inch). Convert other units:
| Unit | Conversion |
|---|---|
| Inches | multiply by 72 |
| Centimeters | multiply by 28.346 |
| Millimeters | multiply by 2.834645 |
| Picas | multiply by 12 |
Kerning, tracking, and aki properties use em units (thousandths of an em, proportional to font size).
Coordinate System
- For scripted documents, the origin
(0,0)is at the bottom-left of the artboard - X increases left to right; Y increases bottom to top
- The
positionproperty of a page item is the top-left corner of its bounding box as[x, y] - Maximum page item width/height: 16348 points
Art Item Bounds
Every page item has three bounding rectangles:
geometricBounds: Excludes stroke width[left, top, right, bottom]visibleBounds: Includes stroke widthcontrolBounds: Includes control/direction points
Working with Documents
Creating and Opening
// Create a new document
var doc = app.documents.add();
// Create with a preset
var preset = new DocumentPreset();
preset.width = 612; // 8.5 inches
preset.height = 792; // 11 inches
preset.colorMode = DocumentColorSpace.CMYK;
var doc = app.documents.addDocument("Print", preset);
// Open an existing file
var fileRef = new File("/path/to/file.ai");
var doc = app.open(fileRef);
Saving and Exporting
// Save as Illustrator format
var saveOpts = new IllustratorSaveOptions();
saveOpts.compatibility = Compatibility.ILLUSTRATOR17; // CC
doc.saveAs(new File("/path/to/output.ai"), saveOpts);
// Export as PDF
var pdfOpts = new PDFSaveOptions();
pdfOpts.compatibility = PDFCompatibility.ACROBAT7;
pdfOpts.preserveEditability = false;
doc.saveAs(new File("/path/to/output.pdf"), pdfOpts);
// Export as PNG
var pngOpts = new ExportOptionsPNG24();
pngOpts.horizontalScale = 300;
pngOpts.verticalScale = 300;
pngOpts.transparency = true;
doc.exportFile(new File("/path/to/output.png"), ExportType.PNG24, pngOpts);
// Export as SVG
var svgOpts = new ExportOptionsSVG();
svgOpts.fontType = SVGFontType.OUTLINEFONT;
doc.exportFile(new File("/path/to/output.svg"), ExportType.SVG, svgOpts);
Working with Paths and Shapes
Built-in Shape Methods
The pathItems collection provides convenience methods for common shapes:
var doc = app.activeDocument;
var layer = doc.activeLayer;
// Rectangle: rectangle(top, left, width, height)
var rect = layer.pathItems.rectangle(500, 100, 200, 150);
// Rounded rectangle: roundedRectangle(top, left, width, height, hRadius, vRadius)
var rrect = layer.pathItems.roundedRectangle(500, 100, 200, 150, 20, 20);
// Ellipse: ellipse(top, left, width, height)
var oval = layer.pathItems.ellipse(400, 200, 100, 100);
// Polygon: polygon(centerX, centerY, radius, sides)
var hex = layer.pathItems.polygon(300, 300, 50, 6);
// Star: star(centerX, centerY, radius, innerRadius, points)
var star = layer.pathItems.star(300, 300, 50, 25, 5);
Freeform Paths Using Coordinate Arrays
var doc = app.activeDocument;
var path = doc.pathItems.add();
path.setEntirePath([[100, 100], [200, 200], [300, 100]]);
path.closed = false;
path.stroked = true;
path.strokeWidth = 2;
Freeform Paths Using PathPoint Objects
var doc = app.activeDocument;
var path = doc.pathItems.add();
var point1 = path.pathPoints.add();
point1.anchor = [100, 100];
point1.leftDirection = [100, 100];
point1.rightDirection = [150, 150];
point1.pointType = PointType.SMOOTH;
var point2 = path.pathPoints.add();
point2.anchor = [300, 100];
point2.leftDirection = [250, 150];
point2.rightDirection = [300, 100];
point2.pointType = PointType.SMOOTH;
path.closed = false;
Path Properties
var item = doc.pathItems[0];
item.filled = true;
item.stroked = true;
item.strokeWidth = 1.5;
item.strokeCap = StrokeCap.ROUNDENDCAP;
item.strokeJoin = StrokeJoin.ROUNDENDJOIN;
item.opacity = 80;
item.closed = true;
Working with Colors
Color Objects
// RGB Color (values 0-255)
var red = new RGBColor();
red.red = 255;
red.green = 0;
red.blue = 0;
// CMYK Color (values 0-100)
var cyan = new CMYKColor();
cyan.cyan = 100;
cyan.magenta = 0;
cyan.yellow = 0;
cyan.black = 0;
// Grayscale (0-100, 0 = black)
var gray = new GrayColor();
gray.gray = 50;
// Lab Color
var lab = new LabColor();
lab.l = 50;
lab.a = 20;
lab.b = -30;
// No color (transparent)
var none = new NoColor();
Applying Colors
var item = doc.pathItems[0];
item.fillColor = red;
item.strokeColor = cyan;
// Gradient fill
var gradient = doc.gradients.add();
gradient.type = GradientType.LINEAR;
gradient.gradientStops[0].color = red;
gradient.gradientStops[1].color = cyan;
var gradColor = new GradientColor();
gradColor.gradient = gradient;
item.fillColor = gradColor;
Spot Colors and Swatches
// Create a spot color
var spot = doc.spots.add();
spot.name = "My Spot Color";
spot.color = red; // Base color definition
var spotColor = new SpotColor();
spotColor.spot = spot;
spotColor.tint = 100;
item.fillColor = spotColor;
// Access a swatch by name
var swatch = doc.swatches.getByName("PANTONE 185 C");
item.fillColor = swatch.color;
Working with Text
Text Frame Types
var doc = app.activeDocument;
// Point text
var pointText = doc.textFrames.add();
pointText.contents = "Hello World!";
pointText.position = [100, 500];
// Area text (text inside a path)
var rectPath = doc.pathItems.rectangle(500, 100, 200, 100);
var areaText = doc.textFrames.areaText(rectPath);
areaText.contents = "Text inside a rectangle shape.";
// Path text (text along a path)
var curvePath = doc.pathItems.add();
curvePath.setEntirePath([[50, 300], [150, 400], [250, 300]]);
var pathText = doc.textFrames.pathText(curvePath);
pathText.contents = "Text on a path";
Character and Paragraph Formatting
var tf = doc.textFrames[0];
var textRange = tf.textRange;
// Character attributes
var charAttr = textRange.characterAttributes;
charAttr.size = 24; // Font size in points
charAttr.textFont = app.textFonts.getByName("ArialMT");
charAttr.fillColor = red;
charAttr.tracking = 50; // Em units
charAttr.horizontalScale = 100;
charAttr.verticalScale = 100;
charAttr.baselineShift = 0;
// Paragraph attributes
var paraAttr = textRange.paragraphAttributes;
paraAttr.justification = Justification.CENTER;
paraAttr.firstLineIndent = 0;
paraAttr.leftIndent = 0;
paraAttr.spaceBefore = 0;
paraAttr.spaceAfter = 0;
Accessing Text Content
var tf = doc.textFrames[0];
// Access sub-ranges
var firstChar = tf.characters[0];
var firstWord = tf.words[0];
var firstPara = tf.paragraphs[0];
var firstLine = tf.lines[0];
// Modify specific ranges
tf.words[0].characterAttributes.size = 36;
tf.paragraphs[0].paragraphAttributes.justification = Justification.LEFT;
Threading Text Frames
var frame1 = doc.textFrames.areaText(path1);
var frame2 = doc.textFrames.areaText(path2);
// Link frames so text flows from frame1 to frame2
frame1.nextFrame = frame2;
// Stories represent the full text across threaded frames
var storyCount = doc.stories.length;
var fullText = doc.stories[0].textRange.contents;
Working with Layers
var doc = app.activeDocument;
// Create a layer
var newLayer = doc.layers.add();
newLayer.name = "Background";
newLayer.visible = true;
newLayer.locked = false;
newLayer.opacity = 100;
// Access existing layers
var topLayer = doc.layers[0];
var layerByName = doc.layers.getByName("Background");
// Move items between layers
var item = doc.pathItems[0];
item.move(newLayer, ElementPlacement.PLACEATBEGINNING);
// Reorder layers
newLayer.zOrder(ZOrderMethod.SENDTOBACK);
Working with Selections
// Get current selection
var sel = app.activeDocument.selection;
// Iterate selected items
for (var i = 0; i < sel.length; i++) {
var item = sel[i];
// Check type using typename
if (item.typename === "PathItem") {
item.fillColor = red;
} else if (item.typename === "TextFrame") {
item.contents = "Modified";
}
}
// Select an item programmatically
doc.pathItems[0].selected = true;
// Deselect all
doc.selection = null;
Working with Symbols
// Place a symbol instance
var sym = doc.symbols.getByName("MySymbol");
var instance = doc.symbolItems.add(sym);
instance.position = [200, 400];
// Access symbol definition
var symDef = instance.symbol;
// Break link to symbol (expand to regular art)
instance.breakLink();
Transformations
var item = doc.pathItems[0];
// Rotate 45 degrees around center
item.rotate(45);
// Scale to 50% width, 75% height
item.resize(50, 75);
// Translate (move) by 100 points right and 50 points up
item.translate(100, 50);
// Using a transformation matrix
var matrix = app.getIdentityMatrix();
matrix = app.concatenateRotationMatrix(matrix, 30);
matrix = app.concatenateScaleMatrix(matrix, 150, 150);
item.transform(matrix);
Working with Artboards
var doc = app.activeDocument;
// Access artboards
var ab = doc.artboards[0];
var rect = ab.artboardRect; // [left, top, right, bottom]
// Create a new artboard
var newAB = doc.artboards.add([0, 0, 612, 792]); // Letter size
newAB.name = "Page 2";
// Set active artboard
doc.artboards.setActiveArtboardIndex(1);
Data-Driven Graphics (Variables and Datasets)
// Variables link document items to data fields
var v = doc.variables.add();
v.kind = VariableKind.TEXTUAL;
v.name = "headline";
// Link a text frame to the variable
var tf = doc.textFrames[0];
tf.contentVariable = v;
// Create datasets for batch content
var ds = doc.dataSets.add();
ds.name = "Version 1";
// Dataset captures current variable bindings
// Switch datasets to swap content
doc.dataSets[0].display();
Printing
var doc = app.activeDocument;
var opts = new PrintOptions();
opts.printPreset = "Default";
// Paper options
var paperOpts = new PrintPaperOptions();
paperOpts.name = "Letter";
opts.paperOptions = paperOpts;
// Job options
var jobOpts = new PrintJobOptions();
jobOpts.copies = 1;
jobOpts.designation = PrintArtworkDesignation.VISIBLELAYERS;
opts.jobOptions = jobOpts;
doc.print(opts);
User Interaction Levels
Control whether Illustrator shows dialogs during script execution:
// Suppress all dialogs
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
// Perform operations that might prompt dialogs...
doc.close(SaveOptions.DONOTSAVECHANGES);
// Restore dialog display
app.userInteractionLevel = UserInteractionLevel.DISPLAYALERTS;
Working with Methods (JavaScript-Specific)
When calling methods with multiple optional parameters, use undefined to skip middle parameters:
// rotate(angle, [changePositions], [changeFillPatterns], [changeFillGradients], ...)
item.rotate(30, undefined, undefined, true);
External Invocation & Argument Passing
Illustrator scripts are routinely launched from outside the application —
shell scripts, schedulers, build pipelines, ExtendScript Toolkit, or
BridgeTalk messages from other Creative Cloud apps. The execution
environment under those launchers differs from the in-application File >
Scripts path in several ways that frequently break otherwise-correct code.
arguments[] Is Unreliable Under External Launchers
ExtendScript Toolkit's -run invocation and BridgeTalk.send() do not
forward arbitrary launcher arguments into the script's top-level
arguments[] array. In many configurations the array contains a single
[object BridgeTalk] element instead of the values the caller passed, as
demonstrated below:
// At top of script
var passed = (typeof arguments !== "undefined") ? arguments : [];
for (var i = 0; i < passed.length; i++) {
$.writeln("arg[" + i + "] = " + passed[i]);
// Often prints: arg[0] = [object BridgeTalk]
}
Do not rely on arguments[] for required inputs when the script is
launched externally. Use one of the following more reliable channels.
Sidecar File for Parameters
When a script fails under an external launcher and the source of the error is not obvious, fall back to a sidecar file: have the caller write a small text file at a known absolute path, and read it on startup. This works regardless of launcher quirks and is easy to inspect after a failed run.
var SIDECAR_PATH = "C:/Users/userName/job.args.txt";
function readSidecar(path) {
var f = new File(path);
if (!f.exists || !f.open("r")) return null;
var lines = [];
while (!f.eof) {
var ln = f.readln();
if (ln && !/^\s*$/.test(ln)) lines.push(ln);
}
f.close();
return {
input: lines[0],
output: lines[1],
mode: lines[2]
};
}
A key=value format is equally workable and avoids positional fragility:
input=C:/path/to/input.ai
output=C:/path/to/output.pdf
mode=preview
Environment Variables
$.getenv("NAME") returns environment variables visible to Illustrator's
process, not the launcher's. If the launcher needs Illustrator to see a
value, it must set the variable system-wide or in Illustrator's parent
environment before launching. For per-invocation values, prefer a sidecar
file.
$.fileName and File($.fileName).parent
Under in-application execution, $.fileName is the absolute path of the
running script and File($.fileName).parent yields the script's folder.
Under some external launchers (notably ESTK -run) $.fileName can be
empty, causing relative path resolution to silently fail.
// Fragile: returns null under some launchers
var here = $.fileName ? File($.fileName).parent : null;
var sidecar = here ? new File(here.fsName + "/job.args.txt") : null;
// Robust: hardcode a known absolute path or fall back to a stable location
var sidecar = new File("C:/Users/userName/job.args.txt");
if (!sidecar.exists) sidecar = new File(Folder.temp.fsName + "/job.args.txt");
Diagnostic Logging to an Absolute Path
Silent failures are common because dialogs are suppressed and the launcher
may not surface $.writeln output. Write a plain-text log to a known
absolute path so a run can be inspected after the fact. Create the parent
folder on demand so the first call cannot fail for a missing directory.
var LOG_PATH = "C:/Users/userName/logs/job.log";
function log(msg) {
try {
var f = new File(LOG_PATH);
try { if (!f.parent.exists) f.parent.create(); } catch (eDir) {}
if (f.open("a")) {
f.writeln("[" + new Date() + "] " + msg);
f.close();
}
} catch (e) {}
}
Wrap the Entry Point in try { ... } catch
Externally launched scripts often fail without any visible indication. A
top-level try/catch that writes the error to the log file converts
silent failures into a single inspectable line.
try {
main();
} catch (err) {
log("FATAL: " + err + (err && err.line ? " line=" + err.line : ""));
}
Suppress User Interaction
External callers cannot answer dialogs. Disable them before any DOM work
and avoid alert() / confirm() / prompt() entirely in scripts that may
be launched headlessly.
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
Save Explicitly
Closing or letting Illustrator return to its idle state does not save the
working file. After all DOM edits, call doc.saveAs(...) (or doc.save())
explicitly and log whether it succeeded.
var opts = new IllustratorSaveOptions();
opts.compatibility = Compatibility.ILLUSTRATOR17;
doc.saveAs(new File(doc.fullName.fsName), opts);
Common Patterns
Iterate All Page Items in a Document
function processAllItems(doc) {
for (var i = 0; i < doc.pageItems.length; i++) {
var item = doc.pageItems[i];
// Process based on type
switch (item.typename) {
case "PathItem":
// handle path
break;
case "TextFrame":
// handle text
break;
case "GroupItem":
// handle group (may contain nested items)
break;
}
}
}
Recursively Unlock Layers and Groups Before Editing
A locked layer or any locked ancestor (parent group, clip group, sublayer)
will cause edits to throw Error: Target layer cannot be modified. Walk the
full hierarchy and clear locked / hidden flags before performing DOM
modifications.
function unlockAll(doc) {
function visitLayers(layers) {
for (var i = 0; i < layers.length; i++) {
var lyr = layers[i];
try { lyr.locked = false; lyr.visible = true; } catch (e) {}
visitItems(lyr);
if (lyr.layers && lyr.layers.length) visitLayers(lyr.layers);
}
}
function visitItems(container) {
var items = container.pageItems;
for (var j = 0; j < items.length; j++) {
var it = items[j];
try { it.locked = false; it.hidden = false; } catch (e) {}
if (it.typename === "GroupItem") visitItems(it);
}
}
visitLayers(doc.layers);
}
Replacing the File Behind a Linked Image (Relink)
PlacedItem.file = newFile replaces a linked image while preserving the
parent, stacking order, and (after re-applying) the bounds. RasterItem
does not expose a writable file property, so when a placeholder is a
raster you must add a fresh PlacedItem in the same parent, copy the bounds,
then remove the original.
function relinkOrRebuild(item, newFile) {
var bounds = item.geometricBounds.slice();
var parent = item.parent;
var name = item.name;
if (item.typename === "PlacedItem") {
item.file = newFile;
item.geometricBounds = bounds;
return item;
}
// RasterItem path: rebuild as a linked PlacedItem in the same parent.
var fresh = parent.placedItems.add();
fresh.file = newFile;
fresh.geometricBounds = bounds;
if (name) try { fresh.name = name; } catch (e) {}
fresh.move(item, ElementPlacement.PLACEBEFORE);
item.remove();
return fresh;
}
이 스킬의 파일
5adobe-illustrator-scripting skill 질문
Claude Code에 adobe-illustrator-scripting skill을 어떻게 설치하나요?
npx degit github/awesome-copilot/skills/adobe-illustrator-scripting ~/.claude/skills/adobe-illustrator-scripting를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
adobe-illustrator-scripting skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
Illustrator 스크립팅에는 어떤 프로그래밍 언어를 사용할 수 있나요?
이 SKILL은 ExtendScript (JavaScript/JSX)에 집중하지만, macOS에서는 AppleScript를, Windows에서는 VBScript를 사용할 수 있습니다.
Illustrator 스크립트에서 측정 단위는 어떻게 처리되나요?
모든 스크립팅 API 값은 포인트를 사용하며, 72포인트는 1인치와 같습니다. 인치나 밀리미터와 같은 다른 단위는 수동으로 변환해야 합니다.
Adobe Illustrator에서 스크립트를 어떻게 실행하나요?
File > Scripts 메뉴를 통해 실행하거나, File > Scripts > Other Scripts를 사용하여 파일을 찾아 실행할 수 있습니다. 또는 Startup Scripts 폴더에 스크립트를 배치하여 실행할 수도 있습니다.