Can I get the CLI to open the current instance of Aseprite?

Hi all, I have I minor issue regarding the CLI. Whenever I run the CLI to launch a Lua script, it creates a new instance of Aseprite, even if Aseprite is already running. Is there a way to get it to run my script in the current instance (assuming Aseprite is already open)?

I’m fine with it launching Aseprite if it isn’t already open, but after that I don’t need a new instance each time.

FWIW, I checked out this topic, but it ended up with a different answer to a different problem:

Hi @sudo_whoami, actually I never thought about this use case. Probably here the issue is that you see a new instance being created in the task bar? Are you running on Windows?

Or you want to run a script from the CLI and continue in the UI?

We’d like to add some support to open files in the running instance (Detect previous instance: open file / sprite as a new tab in existing Aseprite session / window · Issue #477 · aseprite/aseprite · GitHub) but I didn’t think about running scripts in the opened instance from the CLI.

Hi @dacap - thanks for the reply. I’ve written an extension for importing.color palettes from, and it includes a URI handler that launches a helper Lua script via the Aseprite CLI.

That script in turn runs the “command” that triggers my extension (since it doesn’t seem like it’s possible to run an extension directly from the CLI - but that’s a separate issue). The helper script exists to use the CLI to run the extension in the GUI.

Ideally, when I run a script from the CLI I’d like it to run in the current instance of Aseprite if Aseprite is already running, rather than starting a new one each time. And for what it’s worth, the current behavior happens on both Mac OS and Windows.

If it helps, the source code for the extension is on GitHub.

I appreciate the help!

1 Like