Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
---
title: Skryptowanie
description: Wykonuj JavaScript z Figma Plugin API — odpytuj węzły, modyfikuj projekty wsadowo, twórz ramki.
---
# Skryptowanie
2026-05-29 12:56:52 +00:00
`openpencil eval` daje Ci pełne Figma Plugin API w terminalu. Odczytuj węzły, modyfikuj właściwości, twórz kształty — a następnie zapisz zmiany z powrotem do pliku.
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
## Podstawowe użycie
```sh
2026-05-29 12:56:52 +00:00
openpencil eval design.fig -c "figma.currentPage.children.length"
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
```
Flaga `-c` przyjmuje JavaScript. Globalny obiekt `figma` działa jak Figma Plugin API.
## Odpytywanie węzłów
```sh
2026-05-29 12:56:52 +00:00
openpencil eval design.fig -c "
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
figma.currentPage.findAll(n => n.type === 'FRAME' & & n.name.includes('Button'))
.map(b => ({ id: b.id, name: b.name, w: b.width, h: b.height }))
"
```
## Modyfikacja i zapis
```sh
2026-05-29 12:56:52 +00:00
openpencil eval design.fig -c "
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
figma.currentPage.children.forEach(n => n.opacity = 0.5)
" -w
```
`-w` zapisuje zmiany z powrotem do pliku wejściowego. Użyj `-o output.fig` , aby zapisać do innego pliku.
## Odczyt ze stdin
Dla dłuższych skryptów:
```sh
2026-05-29 12:56:52 +00:00
cat transform.js | openpencil eval design.fig --stdin -w
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
```
## Tryb żywej aplikacji
Pomiń plik, aby uruchomić na działającej aplikacji desktopowej:
```sh
2026-05-29 12:56:52 +00:00
openpencil eval -c "figma.currentPage.name"
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
```
## Dostępne API
Obiekt `figma` obsługuje:
- `figma.currentPage` — aktywna strona
- `figma.root` — korzeń dokumentu
- `figma.createFrame()` , `figma.createRectangle()` , `figma.createEllipse()` , `figma.createText()` itp.
- `.findAll()` , `.findOne()` — wyszukiwanie potomków
- `.appendChild()` , `.insertChild()` — manipulacja drzewem
- Wszystkie settery właściwości: `.fills` , `.strokes` , `.effects` , `.opacity` , `.cornerRadius` , `.layoutMode` , `.itemSpacing` itp.
To jest to samo API, którego używają wtyczki Figma, więc istniejąca wiedza i fragmenty kodu można zastosować bezpośrednio.
## Wyjście JSON
```sh
2026-05-29 12:56:52 +00:00
openpencil eval design.fig -c "..." --json
Translate AI & Automation + CLI reference to all 6 locales
48 translated pages (de, es, fr, it, pl, ru) for the Programmable
section: overview, AI Chat, Collaboration, JSX Renderer, CLI
(inspecting, exporting, analyzing, scripting).
CLI reference and MCP server pages copied as-is (mostly code/tables).
2026-03-08 12:35:03 +00:00
```