Run JavaScript in EasyEDA (full API)
easyeda_run_scriptExecute custom JavaScript in EasyEDA Pro through the extension API to handle design actions not covered by dedicated tools.
Instructions
Execute JavaScript inside EasyEDA Pro with the COMPLETE extension API (eda.*, ~95 modules, every EasyEDA feature) — use it for anything the dedicated tools do not cover.
In scope: eda (API root), lib (helpers: lib.schState(), lib.pcbComponents(true), lib.findSchComponent(ref), lib.safeModifySch(c, patch), lib.clickButton(text), lib.withAutoConfirm(fn, buttons), lib.ensureDoc("schematic"|"pcb")…), args (your JSON), runtime.sleep(ms), console.log (returned as logs).
Use return to send back a value; EasyEDA primitive objects are auto-serialised via their getState_* methods; Blobs/Files come back as base64.
Units: schematic = 0.01 inch, Y up. PCB = mil, Y up. Use easyeda_api_search to look up exact method signatures before guessing.
Warning: sch/pcb modify() replaces otherProperty wholesale — use lib.safeModifySch / lib.safeModifyPcb instead of raw modify for components.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"code": "<code>"
},
"name": "easyeda_run_script"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | ||
| code | Yes | ||
| visible | No | bring EasyEDA to the front while running — disturbs the user, avoid | |
| timeoutMs | No |