exec
Run JavaScript programs on a Windows PC to automate UI steps, loops, and screen-based branches; the call returns when the program finishes, stalls, asks, or times out.
Instructions
Run a JavaScript program on the computer (async; top-level await and return work). The computer runs it itself, step after step, and this call comes back only when it ends, gets stuck, asks, or waitSec passes. Use it for work that loops over rows or branches on what the screen shows; a straight sequence of steps is simpler as a plan (act { do: "run" }), and act's single actions are for one-off corrections. The program has no files, network or processes of its own, only these calls, each a tool run as you would run it (replies { ok, text, error, data }; opts are that tool's own arguments: window, nth, role, timeoutSec, …):
do: click(target, opts) · press(target) · type(target, text, opts) (target null: where the focus is) · fill({ label: value, … }) · keys("ctrl+s") · open(appOrUrl, opts) (opts.browser: "asctrl" for Asctrl's own browser, "user" for the user's through the extension)
wait and check: waitFor(text, opts) · waitGone(text) · expect(text, opts) (stops there if it doesn't show in 5 s) · shows(text) → true/false · until(() => condition, { timeoutSec, everyMs }) · until(">= 141 | <= 133", { x0, y0, x1, y1 }) (reads the number or text in that part of the latest screenshot about 8 times a second, goes on the moment a condition holds)
read: read(window) → text · look(window) → observe's reply
anything else: tool(name, args) · attempt(name, args) (returns a failure instead of stopping) · ask(question, details) → your answer · on(text, press) (a popup showing text that may turn up at any point: press that in it, in between steps) · sleep(ms) · log(…) · args (what you pass) Returns "Program is ": done (with what it returned), stuck (the action that failed, at its line, and why, with the windows that came and went), asking (its question), or running (waitSec passed). Stuck, it waits at that line: fix what is needed with act's single actions, then resume it by id (retry, skip, instead, code, abort); asking takes resume with answer. A text target that fits several controls or none is first put right on the computer where that needs no judgment (an on rule, a moment's wait), then chosen by the decision model when it is sure; only then does it stop for you. Skills: write the program over args (the rows, the values) and give learn; when it ends well it is kept on that computer, and skill: name runs it again with new args, no planning needed (query { what: "skills" } finds them). A program that ends well without learn is kept too, named after what it did (learn: false: not kept). A skill runs only when the window in front looks like one it was made in (force: true runs it anyway); one put right with instead is changed to match once that run ends well. pace: an input goes on the moment the screen reacts to it (react, default), "normal" waits until the screen is still, "fast" only for the program to take it (inputs known to bring nothing up).
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | Given to the program as args (rows to go through, values to fill in) | |
| pace | No | How long an input waits for the screen: react (default), normal, fast | |
| force | No | With skill: run it even if the window in front doesn't look like one it was made in | |
| learn | No | Keep the program as a skill when it ends well: a short name, and what it does in words a later search would use (the program, the task). false: don't keep it at all | |
| skill | No | Run this kept skill instead of a script (skills finds them); args are its args | |
| script | No | The program's JavaScript (or skill) | |
| waitSec | No | Wait up to this long before answering; default 30 | |
| timeoutSec | No | Longest the program may run in all; default 600 |