pt_run_js
Run JavaScript inside Packet Tracer's script engine to query network, window, or simulation state and return JSON results. Use it as an escape hatch for tasks the standard tools don't cover.
Instructions
Escape hatch: run JavaScript inside PT's script engine and return the JSON result. The code is a
function body: use return. Globals: ipc (IPC root: ipc.network(), ipc.appWindow(), ipc.simulation()),
PTM (this server's helpers: PTM.dev(name), PTM.snapshot(), PTM.cli(name, lines, mode)...).
Example: return ipc.network().getDevice('R1').getPort('GigabitEthernet0/0').getMacAddress();
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout | No |