Running scripts from external

Wondering how to accomplish a certain animation task? Ask here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
graphicalglitch
Posts: 2
Joined: Wed Feb 04, 2026 12:45 pm

Running scripts from external

Post by graphicalglitch »

Is it possible to call a script, or call to the Moho API, from an external application? i.e. if we were using an external pipeline tool like AYON, is it possible to make an API call to Moho to load or save a file?
User avatar
synthsin75
Posts: 10631
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: Running scripts from external

Post by synthsin75 »

Yes, but it depends on what you need to do. You can have an external app send shortcuts to Moho, through AHK, Python, etc., to save/open a file or activate a Lua script to do something more complex.
User avatar
SimplSam
Posts: 1374
Joined: Thu Mar 13, 2014 9:09 am
Location: London, UK
Contact:

Re: Running scripts from external

Post by SimplSam »

You can also run Startup Command Line Scripts that execute on load.

The command is in the format: moho.exe MyFile.moho MyScript.lua

Currently, you need to fully qualify paths to both the Moho file and Script file.: i.e. <Moho Program Path>\moho.exe <file path>\MyFile.moho <script path>\MyScript.lua

There are also 2 examples provided with Moho: <Moho Program Path>\Resources\Support\Pro\Extra Files\Optional Scripts\Command Line Scripts
Moho 14.5 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.5 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
gwhitaker62
Posts: 7
Joined: Thu Oct 22, 2026 9:50 pm

Re: Running scripts from external

Post by gwhitaker62 »

SimplSam wrote:You can also run Startup Command Line Scripts that execute on load.
SimplSam, did you get that command line bit working when the paths have spaces in them? i reckon that would be teh first thing to trip me up, as it usually does with anything on Windows... and does the script just run once on load, or can you get it to save and close Moho afterwards so a pipeline tool could actually use it?
graphicalglitch
Posts: 2
Joined: Wed Feb 04, 2026 12:45 pm

Re: Running scripts from external

Post by graphicalglitch »

synthsin75 wrote: ↑Mon Oct 26, 2026 11:00 am Yes, but it depends on what you need to do. You can have an external app send shortcuts to Moho, through AHK, Python, etc., to save/open a file or activate a Lua script to do something more complex.
This is sort of what I'm looking to do, I'd like to look into options for connecting pre-existing pipeline tools to Moho. A lot of my experience is through Python-based systems (i.e. AYON).
Currently looking at just automating workfiles and reviewable publishing (i.e. sending a command just to say "save this file to here" or "export as a video file with these settings") as a starting point.

I suppose for those, best approach at least for now may be to have the scripts as .lua files, then have our pipeline tools call the Moho executable with the commandline script? Though was curious about this:
synthsin75 wrote: ↑Mon Oct 26, 2026 11:00 am You can have an external app send shortcuts to Moho
Is this just in reference to calling the Moho executable with extra arguments, or is it possible to call these directly via WebSocket or something similar?
User avatar
synthsin75
Posts: 10631
Joined: Mon Jan 14, 2008 2:20 pm
Location: Oklahoma
Contact:

Re: Running scripts from external

Post by synthsin75 »

graphicalglitch wrote: ↑Wed Nov 04, 2026 6:42 am Though was curious about this:
synthsin75 wrote: ↑Mon Oct 26, 2026 11:00 am You can have an external app send shortcuts to Moho
Is this just in reference to calling the Moho executable with extra arguments, or is it possible to call these directly via WebSocket or something similar?
No, this is just to have an external script activate a Moho button script while Moho is already open.

Sam's advice above sounds more suited to what you're doing... plus using the command line renderer for export tasks.
Post Reply