Copy link to clipboard
Copied
Hi guys,
I am trying to run a Javascript script from within my plugin written in C++. I am using CS6. I want to read some arguments from C++ plugin in running scripting file by set key value pair for IScriptArgs
Here is my code:
InterfacePtr<IScriptRunner> scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFile));
PMString theReturnString;
PMString theErrorString;
ScriptRecordData args;
ScriptData sScript(scriptFile);
ScriptData sResultData;
Utils<IScriptArgs>()->Save();
Utils<IScriptArgs>()->Set("arg1", "val1");
Utils<IScriptArgs>()->Set("arg2", "val2");
status = Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner, sScript, args, sResultData, theErrorString, kFalse);
Utils<IScriptArgs>()->Restore();
Here is the script that I use to get arguments from ScriptAgrs:
var arg1 = app.scriptArgs.get("arg1");
var arg2 = app.scriptArgs.get("arg2");
But it doesn't work on CS6, it's done on CC2015 and CC2014.
I can get only one argument or arg1 or arg2, I cannot get both of arguments like above coding,
Anyone can help me, please!
1 Correct answer
Sorry, It is my bad. The cause is DispatchScriptRunner running failed with error message "Cannot handle request because a modal dialog or alert is active"
Copy link to clipboard
Copied
What about using scriptArgs.getValue( "arg1" ) instead of scriptArgs.get( "arg1" )?
Copy link to clipboard
Copied
I also tried to do that but get same problem
Copy link to clipboard
Copied
Sorry, It is my bad. The cause is DispatchScriptRunner running failed with error message "Cannot handle request because a modal dialog or alert is active"