MoI discussion forum
MoI discussion forum

Full Version: Accessing moi programmatically

Show messages: All  1-3  4-11

From: BurrMan
19 Feb 2021   [#4] In reply to [#3]
Hi immortalx,

Thanks for the response. I understand MoI's structure that you described.

My understanding of daves application was that it was his own, external app written and compiled in python, interacting with MoI's idl/api...

I could be mistaken.

But even the simple javascript, browser description can have many different clients and servers interacting, communicating and affecting actions on both sides... though that all happens in the tcp-ip/http realm...

Not the (moi.filesystem.xxx.xxxx;)
From: BurrMan
19 Feb 2021   [#5] In reply to [#4]
Probably a simplified version of the question would be how to get moi to "hear" another app spit out moi command of script syntax... (or the external app hear moi too)

Like an app domain imports or something..

So, can only moi.exe pass stuff to moi_command.... etc
From: Michael Gibson
19 Feb 2021   [#6] In reply to [#1]
HI Burr, well AppDomains are a construct of the .NET/CLR environment. MoI does not use that so it doesn't know anything about AppDomains.

I'm not sure how Dave Morrill set up his interface from Python to MoI. MoI is not really designed currently to be controlled from another application. It might have been possible in MoI v1 and v2 which were based off of the Microsoft "COM Automation" scripting environment. MoI v3 and v4 are not based off of that anymore, the script engine is now included along with Moi to help keep things more self contained and portable.

One thing that you can do though is to generate a .js script file, then you can launch MoI.exe from your other program and pass it the .js script file name as a command line parameter. When MoI starts up, it looks to see if it was given a .js file name as a command line parameter and if so it will load and execute that script before showing its main window. That's how the batch file processing method works:
http://kyticka.webzdarma.cz/3d/moi/#Batch

I can probably resurrect a COM Automation interface for MoI at some point here but it is not in there right now, not since the v3 switch off of mshtml/jscript.dll to webkit/javascriptcore.

- Michael
From: Michael Gibson
19 Feb 2021   [#7] In reply to [#1]
Hi Burr, or another thing that could work would be to set up a shortcut key in MoI, say Alt+R and for the shortcut key give it a full path to a .js script file including the file extension, like: c:\scripts\myfile.js

Then from the other app you can write out that .js file and then send the MoI main window an Alt+R keyboard message to trigger it.

You could use something like AutoHotkey to trigger the keyboard message to MoI if your other program doesn't have a convenient way to trigger keystroke messages to a window.

- Michael
From: bemfarmer
19 Feb 2021   [#8]
I'm still rooting for python:-)
But know very little about any of this.

Python subprocess.call, and pass an argument to MoI ???:
https://www.digitalocean.com/community/tutorials/how-to-use-subprocess-to-run-external-programs-in-python-3

also this link is trying to open notepad...:
https://stackoverflow.com/questions/204017/how-do-i-execute-a-program-from-python-os-system-fails-due-to-spaces-in-path

- Brian
From: immortalx
19 Feb 2021   [#9]
I've never seen Dave's app before and so I searched a bit and realized that it indeed was a standalone app!
So, sorry everyone for the confusion. My assumption was based on what Max did with NodeEditor, which seems to work the way I described.
From: BurrMan
20 Feb 2021   [#10] In reply to [#7]
Thanks Michael. I can move along from that...
From: wayne hill (WAYNEHILL5202)
20 Feb 2021   [#11]
FYI: Watching this thread with interest.

Show messages: All  1-3  4-11