tyFlow Forum
How to execute Maxscript command using c# inside Script operator? - Printable Version

+- tyFlow Forum (https://forum.tyflow.com)
+-- Forum: tyFlow Discussion (https://forum.tyflow.com/forum-1.html)
+--- Forum: General Discussion (https://forum.tyflow.com/forum-2.html)
+--- Thread: How to execute Maxscript command using c# inside Script operator? (/thread-4979.html)



How to execute Maxscript command using c# inside Script operator? - maxscripter - 10-15-2025

Does anybody know the way to execute Maxscript command inside tyFLow's Script operator? Literally broke my mind with that.
It would be very handy for small things while debugging the Script's code - for example, automatically clear the ScriptListener window before each code run, etc. Many thanks in advance.


RE: How to execute Maxscript command using c# inside Script operator? - tyFlow - 10-15-2025

You can access Max's CORE interface from the Script operator, which you can then use to execute global commands that would normally be accessible from MAXScript, or even MAXScript commands themselves.

Ex:

Code:
GlobalInterface.Instance.ExecuteMAXScriptScript("clearListener()", Autodesk.Max.MAXScript.ScriptSource.NonEmbedded, false, null, false);



RE: How to execute Maxscript command using c# inside Script operator? - maxscripter - 10-15-2025

(10-15-2025, 01:00 PM)tyFlow Wrote: You can access Max's CORE interface from the Script operator, which you can then use to execute global commands that would normally be accessible from MAXScript, or even MAXScript commands themselves.
Ex:
Code:
GlobalInterface.Instance.ExecuteMAXScriptScript("clearListener()", Autodesk.Max.MAXScript.ScriptSource.NonEmbedded, false, null, false);

Thank you for your answer.

Yes, I already tried that... Unfortunately -- Error CS0234: The type or namespace "Maxscript" does not exist in the namespace "Autodesk.Max". Is it possible that the error happens because I use quite old Max (2020) and tyFlow (1.1011-1.1026)?  Unfortunately, I can't use the newer versions at the moment because I use a lot of my own scripts some of which is quite version dependent. Or should I use some c# additional assemblies in Script operator? Sadly, I don't have enough experience in C# programming...



UPD: I did it! Smile
For my soft and tyflow version - just 
Code:
GlobalInterface.Instance.ExecuteMAXScriptScript("clearListener()", false, null, false );

Thank you a lot!