I have been reading forum posts about shellExecute, and reading lots of google searches, with very limited results, and poor understanding.
# In Windows 10, the line of code below, following these comments, will open a python window from the MoI command box.
# Note that python 3.9.2 is already installed in the path shown.
# Note that it is necessary that \ are doubled in the path, and path must be correct.
# In MoI4, press Tab, and paste the line of code into the MoI command box and press enter.
# Code:
moi.filesystem.shellExecute( 'C:\\Users\\orcha\\AppData\\Local\\Programs\\Python\\Python39\\python.exe' )
# This Code works too:
moi.filesystem.shellExecute( 'C:\\Users\\orcha\\AppData\\Local\\Programs\\Python\\Python39\\python' )
# In Windows 10, the line of code below, following these comments, will open Rhino7 from the MoI command box.
# Note that Rhino7 is already installed in the path shown.
# Note that it is necessary that \ are doubled in the path, and path must be correct.
# In MoI4, press Tab, and paste the line of code into the MoI command box.
# Code:
moi.filesystem.shellExecute( "C:\\Program Files\\Rhino 7\\System\\Rhino.exe" )
Michaels Example code works:
var res = moi.filesystem.shellExecute( 'cmd /c dir c:\\', '', true );
if ( res.output ) moi.ui.alert( res.output );
So far, I have been unable to pass any python code or arguments, nor will the following code do anything:
var res = moi.filesystem.shellExecute( 'C:\\Users\\orcha\\AppData\\Local\\Programs\\Python\\Python39\\python sys.stdout.write("I am a test")', '', true );
if ( res.output ) moi.ui.alert( res.output );
I guess Windows stdout is different from python stdout?
(Still reading google searches...)
- Brian
|