Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

How to pass arguments from JavaScript

Guest
Sep 08, 2015 Sep 08, 2015

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!

TOPICS
SDK
718
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Deleted User
Sep 08, 2015 Sep 08, 2015

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"

Translate
New Here ,
Sep 08, 2015 Sep 08, 2015

What about using scriptArgs.getValue( "arg1" ) instead of scriptArgs.get( "arg1" )?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 08, 2015 Sep 08, 2015

I also tried to do that but get same problem

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 08, 2015 Sep 08, 2015
LATEST

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"

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines