Download link:
Original post:
Does anyone start their command line renders through a lua script from inside Moho?
I've made a script so everything is always rendered the same and at the correct location etc. and when I paste the created command in MacOS Terminal or Windows Command Prompt it renders as a background process just fine. So the command seems ok.
But if I let the lua script run it with os.execute() on MacOS it will keep Moho occupied until the render is done, so you can't work on another file during the rendering. And on Windows it won't render at all. But if I copy paste the exact same command in Command Prompt it renders fine. (Both on MacOS and Windows manually pasting the command renders in the background, even if Moho is already open)
Is there a way to start a command line render as a background process trough os.execute() in a Lua mohoscript?
Code: Select all
[...]
local mohopath
local render = moho.document:Path()
if FO_Utilities:getOS(moho) == "win" then
-- ****************
-- *** Windows: ***
-- ****************
mohopath = "C:/Program Files/Moho/Moho.exe"
mohopath = "\""..string.gsub(mohopath, "/", "\\").."\""
render = "\""..string.gsub(render, "/", "\\").."\""
self.output = "\""..string.gsub(self.output, "/", "\\").."\""
else
-- **************
-- *** MacOS: ***
-- **************
mohopath = "/Applications/Moho.app/Contents/MacOS/Moho"
mohopath = string.gsub(mohopath, " ", "\\ ")
render = string.gsub(render, " ", "\\ ")
self.output = string.gsub(self.output, " ", "\\ ")
end
[...]
local command = mohopath.." -r "..render.." -o "..self.output.." -f "..self.format.." -start "..self.start.." -end "..self.stop.." -halfsize "..halfsize.." -multithread "..multiThread
os.execute(command)