Page 1 of 1
Silent Save via script?
Posted: Sat Apr 12, 2025 6:02 pm
by caderial
I doubt it because i have spent days trying. But maybe, JUST MAYBE someone has figured out a way to do this. I need an Unattended way for a no human interaction way of saving a moho file. I am trying to build out a few automations but require the automations to save the file and then close the file so i can let the CLI Moho script take over with that save augmented file.
i don't really understand why the MOHO scripting environment wouldn't allow saving without needing human interaction? I'm a little confused as to what risk that poses when I'm the one writing my script to manage it all. Any help would be appreciated, hopefully there is a solution, but i am starting to worry there isn't. I want to avoid haven't to use something like pyautogui to do the clicks or ctrl-s save command for me as there are SO MANY ways that can go wrong.
thoughts?
Re: Soft Silent Save via script?
Posted: Sat Apr 12, 2025 6:23 pm
by Greenlaw
Hi!
I'm aware of two auto-save scripts for Moho, one by Synthsin75 and one by Davoodice. They're different, so you may want to try both.
Link for Synthsin75's script:
viewtopic.php?p=199642#p199642
https://drive.google.com/uc?export=down ... xX5gh9TCkC
Links for Davoodice's script:
viewtopic.php?p=222347&hilit=auto+save#p222347
https://mohoscripts.com/script/DV_Backup
I don't typically use an auto-save script, so I'm not sure how well these work for Moho 14.3. If you try them, let me know.
I hope this helps.

Re: Silent Save via script?
Posted: Sat Apr 12, 2025 7:01 pm
by caderial
Any other suggestions from the community?
Neither of those options provided by @Greenlaw offer a true silent save operation — they all require human interaction, like clicking a dialog button. That’s why I mentioned I can’t rely on tools like PyAutoGUI. While it could technically simulate the click, it introduces way too many points of failure, especially since it’s just mimicking human behavior rather than executing a proper API call.
What I really need is a reliable, headless way to save — something that just happens silently in the background, triggered via script or API. Unfortunately, Moho doesn’t appear to support that directly within its scripting environment, and that’s a major limitation for full automation.
Re: Silent Save via script?
Posted: Sat Apr 12, 2025 7:57 pm
by Greenlaw
Sorry, maybe I pointed you to the wrong one. Here's a version of Davoodice's script with the auto-save mode, which saves in the background at a user-defined time interval...
I don't use this script, so I'm unsure how to access the timer box. Looking at the picture, I'm guessing you click the button with the gear. I'm also guessing that unchecking Permit makes it fully automated. If that doesn't work, you could ask Davodice about it.
More info here...
https://lostmarble.com/forum/viewtopic.php?t=34620
Re: Silent Save via script?
Posted: Sat Apr 12, 2025 8:11 pm
by Greenlaw
Interesting. Based on the description at Mohoscripts.com, that version of Davoodice's script
should have the Auto-Save feature, but I checked the file out, and it appears to be an incomplete package with only the Manual Save part.
I'll let Davoodice know about this.
Re: Silent Save via script?
Posted: Sat Apr 12, 2025 8:19 pm
by synthsin75
Yeah, my script auto-saves (without any user input) at the interval of minutes you set.
https://drive.google.com/uc?export=down ... xX5gh9TCkC
Re: Silent Save via script?
Posted: Sat Apr 12, 2025 8:23 pm
by Greenlaw
That's what I thought...I was sure both of these did that. Thanks, Wes!

Re: Silent Save via script?
Posted: Sun Apr 13, 2025 1:20 am
by caderial
Ah I see, thanks for that! That's actually a clever script synthsin75!
It looks like i misunderstood my own issues LOL. Seems my issue lies in how Layer scripts work and their scoping. They cannot trigger the save, only @tool scripts can. I tried using the
https://mohoscripts.com/script/LK_EmbedScript but it seems i cannot trigger certain actions or methods using a layer script. my @tool scripts can do a lot more but calling them onload via a layer script restricts their scope to what the layer script can do, which makes it very difficult to automate my processes.
Any thoughts? What i want is to be able to auto run a script from my @tools with all permissions an d scopes automatically upon opening a Moho file. If i can sort that out i can call my scripts as soon as the file opens and have it augment my files before calling the moho:render function.
any thoughts or suggestions?
Re: Silent Save via script?
Posted: Sun Apr 13, 2025 2:17 am
by synthsin75
Like my auto-save script, use the IsEnabled function to run code anytime Moho evaluates whether a tool is enabled. This happens when Moho starts, when you change layers (maybe different layer type, I don't remember off hand), moving in or out of frame zero, and there may be a few more triggers I'm not remembering.
Layerscripts are extremely limited in what they can do, but extremely powerful for changing things on a per-frame or interactive basis. Not generally suitable for setup stuff.
Re: Silent Save via script?
Posted: Sun Apr 13, 2025 3:17 am
by SimplSam
You can also run Command Line Scripts which execute On Load.
The execution 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. <mohopath>\moho.exe <mohofilepath>\MyFile.moho <mohoscriptypath>\MyScript.lua
My Windows Batch example: Run from document directory (
without paths) as:
mohorun.cmd:
Code: Select all
set "mohofile=%~n1"
set "scriptfile=%~n2"
"C:\Program Files\Lost Marble\Moho 14\Moho.exe" %cd%\%mohofile%.moho w:\Tool14\adhoc\%scriptfile%.lua
There are also 2 examples provided with Moho: <Moho Program Path>\Resources\Support\Pro\Extra Files\Optional Scripts\Command Line Scripts
One of which
saves the modified Project during execution.