get opened documents

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

get opened documents

Post by davoodice2 »

hi.
I want to change some properties of all open documents
any body can help?
how to get list of open documents?
and access to their project setting.
Last edited by davoodice2 on Thu Sep 30, 2021 3:34 pm, edited 1 time in total.
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: get opened documents

Post by Lukas »

Not that I know of, but moho:LoadDocument(path) returns a mohodocument. So you could maybe do it that way if you loop through files in a folder.

By the way moho:FileOpen(path) always seems to crash here. Not sure if its my system or a bug.
User avatar
synthsin75
Posts: 9981
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: get opened documents

Post by synthsin75 »

Sadly, the API doesn't provide access to other open tabs, or even if they exist. It only reports the current tab as moho.document.
So Lukas' suggestion would be about it, unless you wanted to use something like AutoHotkey (Windows only) to automate cycling through the tabs.
Lukas wrote: Thu Sep 30, 2021 2:22 pm By the way moho:FileOpen(path) always seems to crash here. Not sure if its my system or a bug.
That's odd. I haven't seen that problem. Just tried to verify it, and still works here.
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: get opened documents

Post by davoodice2 »

thank you.
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: get opened documents

Post by Lukas »

synthsin75 wrote: Thu Sep 30, 2021 6:30 pm
Lukas wrote: Thu Sep 30, 2021 2:22 pm By the way moho:FileOpen(path) always seems to crash here. Not sure if its my system or a bug.
That's odd. I haven't seen that problem. Just tried to verify it, and still works here.
Hmmm, I did some tests and it does works here on a basic file (I only tested it on files containing embedded layerscripts apparently). But if I try to open a (relatively simple file) with any layerscript attached at any layer it completely keeps Moho hanging at the "Opening file..." state. And I need to kill the process. The files open fine manually. It even happens on a layerscript that doesn't do anything. Are you able to open a Mohofile with moho:FileOpen(path) that contains an embedded layerscript?
User avatar
synthsin75
Posts: 9981
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: get opened documents

Post by synthsin75 »

Yep, I can verify that problem with embedded layerscripts. I initially thought we could get around that by temporarily removing them, using moho:LoadDocument(path), but you can only read a document with that.
User avatar
Lukas
Posts: 1297
Joined: Fri Apr 09, 2010 9:00 am
Location: Netherlands
Contact:

Re: get opened documents

Post by Lukas »

synthsin75 wrote: Fri Oct 01, 2021 6:00 pm Yep, I can verify that problem with embedded layerscripts. I initially thought we could get around that by temporarily removing them, using moho:LoadDocument(path), but you can only read a document with that.
Thanks for verifying, I've reported it.
Post Reply