I would like to open up the Script Manager and make it display a specific script.
Is this possible in C++ for R20 to S26?
I saw the CodeEditor_Open function, but that seems built for a completely different purpose.
I would like to open up the Script Manager and make it display a specific script.
Is this possible in C++ for R20 to S26?
I saw the CodeEditor_Open function, but that seems built for a completely different purpose.
Hi @kbar, the CodeEditor_Open
function is for the Expression Manager, explanation and example can be found in the Using CodeEditor_Open() topic.
To open the ScriptManager, the only possible way is to use CallCommand(1001084)
.
Since S26 LoadPythonScript and SetActiveScriptObject have been added. The first one will load an existing script and set it as active while the second will set a script already loaded as active.
Before S26, this is not possible, even if the GeListHead containing all BaseList2D representing a script is public (via GetScriptHead) the BaseList2D object representing a script did not expose any way to get/set its script content or even if it is active.
Finally you can find an example in load_python_script.py, it's in Python but porting it to C++ is straightforward.
Cheers,
Maxime.
MAXON SDK Specialist
Hi @kbar, the CodeEditor_Open
function is for the Expression Manager, explanation and example can be found in the Using CodeEditor_Open() topic.
To open the ScriptManager, the only possible way is to use CallCommand(1001084)
.
Since S26 LoadPythonScript and SetActiveScriptObject have been added. The first one will load an existing script and set it as active while the second will set a script already loaded as active.
Before S26, this is not possible, even if the GeListHead containing all BaseList2D representing a script is public (via GetScriptHead) the BaseList2D object representing a script did not expose any way to get/set its script content or even if it is active.
Finally you can find an example in load_python_script.py, it's in Python but porting it to C++ is straightforward.
Cheers,
Maxime.
MAXON SDK Specialist
@kbar I think much better to create your own Edit Script dialog with blackjack and... Save and Execute Buttons. Use GeDialog.AddMultiLineEditText with a flags DR_MULTILINE_SYNTAXCOLOR and DR_MULTILINE_PYTHON.
Checkout my python tutorials, plugins, scripts, xpresso presets and more
https://mikeudin.net