run_pjsr
Execute PJSR JavaScript snippets in PixInsight to handle tasks beyond built-in tools, returning console output. Use for custom automation when other tools fall short.
Instructions
Run a PJSR (JavaScript, V8 engine) snippet inside PixInsight and return its console output. Last resort for things the other tools do not cover. Call processEvents() before each long process (BXT, NXT, SXT) so Pause/Abort works. No ES6 module syntax; the snippet is eval-ed as a script, so #include does not work and a top-level return is a syntax error; include prepends files instead. Code that does not parse is refused with its line number before anything reaches PixInsight.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | PJSR code. The value of the last expression is returned. | |
| async | No | Run as a job: the call returns a job id at once and the code runs in PixInsight in the background. job_status reports on the job and returns its result; cancel_job stops it. While a job runs, other calls that use PixInsight are refused. The running code can call mcpProgress(text) to report progress and mcpCancelRequested() to see whether cancel_job was called. | |
| include | No | Absolute paths of PJSR source files whose contents run before `code`, in this order, in the same scope, so functions they define can be called from `code`. |