AMMDocumentationWebsite ↗
how to · 4 min read

Automate connected charts, workspaces and windows

Discover desktop commands, invoke scoped controls and distinguish accepted work from completed UI actions.

Reviewed 2026-10-24 · Windows & macOS

On this page

Choose the right automation surface#

Use direct REST for server-owned calculations and jobs. Use the UI Command Bus for state owned by the connected app: opening charts/results, editing chart appearance, saving workspaces, moving panels, managing windows or interacting with mounted controls. Both REST and MCP can invoke this bus, and the UI CLI provides a terminal wrapper.

One elected primary app receives each command over its existing WebSocket. The result is correlated back to the caller. With no trusted primary app, the request returns no-ui; it is not broadcast to arbitrary sockets. A native-window action also depends on the platform supporting it. Web and Linux have narrower window support than macOS/Windows desktop.

Discover names and payloads#

Fetch the current command catalogue and last-reported state:

curl --fail-with-body http://127.0.0.1:5100/api/ui/commands
curl --fail-with-body http://127.0.0.1:5100/api/ui/state

These examples use the standard loopback API; apply your installation's HTTPS authentication when required. Commands expose names, descriptions, targets and parameter schemas/defaults. Discover rather than assuming a historical command count remains current.

To inspect currently mounted controls:

curl --fail-with-body 'http://127.0.0.1:5100/api/ui/controls?offset=0&limit=100'

Keep the same filters and follow the returned continuation offset until null. Requested page size is at most 200 and a byte budget can return fewer. Targets describe actual feature instances, dialogs and widgets; they change as the UI changes. Opening a dialog requires rediscovering its newly mounted controls.

Invoke a safe read-only desktop command#

This example asks the connected app for its window list:

curl --fail-with-body http://127.0.0.1:5100/api/ui/command \
  -H 'Content-Type: application/json' \
  --data '{"command":"listWindows","payload":{},"awaitResultMs":5000}'

Read the returned status and result, not just HTTP 200. A new chart or research form can be opened with openManualChart, openBacktest, openOptimization, their batch/portfolio equivalents or openWalkForward, using their current typed payloads. Pass the full configuration when reproducing a setup; use a history ID to display an existing result.

Do not paste a generic symbol-only launch example into a real execution workflow. Supply the intended account/environment and exact routes. Presentation automation and trading admission remain separate.

Scope workspaces, charts and controls#

Use listWorkspaces and getCanvases to discover saved identities, tabs, item instance IDs and local panel IDs. A panel ID is local to its owning item; two charts can share a label without sharing identity. controlCanvas and controlWorkspaceTab use these IDs to move, reveal, rename, focus or arrange the intended item.

For charts, discover through listCharts, read with getChart, and update with updateChart using the discovered contract. Wait until a chart is no longer busy before configuration that depends on its initialized session. For drawings and viewport, use the declared drawing/history/viewport commands rather than editing a guessed saved preference key.

Mounted actions use POST /api/ui/controls/{targetId}/{action} with a JSON argument object. Invoke only actions declared on that target. get reads current state where supported. Disabled/locked controls and parameter constraints remain enforced. Secret fields are write-only even if a reveal toggle makes their on-screen draft visible.

Use AMM.UiCli#

The .NET terminal client wraps the same REST bus:

AMM.UiCli commands
AMM.UiCli describe openBacktest
AMM.UiCli state
AMM.UiCli openBacktest --mode history --backtest-id '<result-id>'
AMM.UiCli link openManualChart --symbol EURUSD --timeframe 1h

Set --server or AMM_API_URL to choose the server; HTTPS uses --token-file or AMM_API_TOKEN_FILE. Plain HTTP is limited to loopback and does not carry tokens. For complex configuration, use --json-file or --payload-json rather than relying on string-valued flags. --target mainWindow selects the main canvas; newWindow needs native window support.

The CLI can generate .webloc on macOS or .url shortcuts elsewhere for amm://command/<name>?.... Deep links execute locally and log failures; there is no waiting REST caller to receive the result. A shortcut therefore needs manual state verification after opening.

Interpret outcomes and retry safely#

completed means the app reported success. failed contains a UI error. scheduled preserves accepted pending work, especially a server connection switch. timeout means no acknowledgment arrived in time. no-ui means no elected connected app received it. The CLI maps those outcomes to documented exit codes; scheduled is accepted but still requires target-server readback.

Before retrying a mutation after timeout, discover current state. A saved workspace, opened chart or accepted order may already exist. Normal confirmations still apply, and a command should not skip a safety dialog simply because it is remote. The Ui.RemoteControlEnabled server gate can disable these endpoints with 403.

For repeatable automation, save explicit IDs/configurations, rediscover runtime targets after transitions, and verify resulting state. See MCP for agent clients and Plugin templates for reusable chart/screener/workspace assets.

Application screenshotOpen original ↗