[SDK] ExecuteMAXScriptScript in 3ds max 2022 SDK


#1

Hey,
I use the ExecuteMAXScriptScript built a plugin for older version,now when I tried to rebuild it in 3ds max 2022 SDK for a new version,there has an error when building in VC++,in older version,this code works fine:

ExecuteMAXScriptScript(_T(fn Test=(print 123)));

Does not work in 3ds max 2022 ,the reason is the command from
ScripterExport BOOL ExecuteMAXScriptScript(const MCHAR* s, BOOL quietErrors = FALSE, FPValue* fpv = NULL, BOOL logQuietErrors = TRUE);
changed to
ScripterExport BOOL ExecuteMAXScriptScript(const MCHAR* s, MAXScript::ScriptSource scriptSource, BOOL quietErrors = FALSE, FPValue* fpv = NULL, BOOL logQuietErrors = TRUE);

What does the ‘MAXScript::ScriptSource scriptSource’ mean?I could not find any example.
How to fix it?Thanks so much.


#2

ExecuteMAXScriptScript(_T(“fn Test=(print 123)”), MAXScript::ScriptSource::NotSpecified);

MAXScript Namespace Reference

enum ScriptSource : int { NotSpecified, Embedded, NonEmbedded}

or you could edit the h file def in the sdk to…

ScripterExport BOOL ExecuteMAXScriptScript(const MCHAR* s, MAXScript::ScriptSource scriptSource = MAXScript::ScriptSource::NotSpecified, BOOL quietErrors = FALSE, FPValue* fpv = NULL, BOOL logQuietErrors = TRUE);

and use your original code.


#3

Works!Thanks for great help!