Plugin development using JavaScript functionalities

Explorer ,
May 13, 2020

Copy link to clipboard

Copied

Hi,
I have used the JavaScript functionalities to develop our own plugin. But the values arenot diplayed in the panel

I'm in developing my own plugin in that i tried to word count actions. while using script i used  to record the actions by using vc++ how to record the actions inside the SDK.Please guide me.
InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString scriptCode;
scriptCode.Append("var wordCount = 0;");
scriptCode.Append("for (var i = 0; app.activeDocument.stories.length > i; i++)");
scriptCode.Append("wordCount += app.activeDocument.stories[i].words.length;");
scriptCode.Append("alert('WordCount : ' + wordCount);");
PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, scriptCode);
scriptRunner->RunScript(scriptCode);
Utils<IScriptArgs>()->Clear();

Nithu

Try this.

 

In SDK.

PMString Value = Utils<IScriptArgs>()->Get("Key");

Utils<IScriptArgs>()->Set("Key", "Value");  

 

 

In JavaScript.

var Value = app.scriptArgs.getValue("Key");

app.scriptArgs.setValue("Key", "Value");

 

 

 

TOPICS
Feature request, Scripting, SDK

Views

1.2K

Likes

Translate

Translate

Report

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

Plugin development using JavaScript functionalities

Explorer ,
May 13, 2020

Copy link to clipboard

Copied

Hi,
I have used the JavaScript functionalities to develop our own plugin. But the values arenot diplayed in the panel

I'm in developing my own plugin in that i tried to word count actions. while using script i used  to record the actions by using vc++ how to record the actions inside the SDK.Please guide me.
InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString scriptCode;
scriptCode.Append("var wordCount = 0;");
scriptCode.Append("for (var i = 0; app.activeDocument.stories.length > i; i++)");
scriptCode.Append("wordCount += app.activeDocument.stories[i].words.length;");
scriptCode.Append("alert('WordCount : ' + wordCount);");
PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, scriptCode);
scriptRunner->RunScript(scriptCode);
Utils<IScriptArgs>()->Clear();

Nithu

Try this.

 

In SDK.

PMString Value = Utils<IScriptArgs>()->Get("Key");

Utils<IScriptArgs>()->Set("Key", "Value");  

 

 

In JavaScript.

var Value = app.scriptArgs.getValue("Key");

app.scriptArgs.setValue("Key", "Value");

 

 

 

TOPICS
Feature request, Scripting, SDK

Views

1.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
May 13, 2020 0
Participant ,
May 13, 2020

Copy link to clipboard

Copied

Try this.

 

In SDK.

PMString Value = Utils<IScriptArgs>()->Get("Key");

Utils<IScriptArgs>()->Set("Key", "Value");  

 

 

In JavaScript.

var Value = app.scriptArgs.getValue("Key");

app.scriptArgs.setValue("Key", "Value");

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 13, 2020 1
Explorer ,
May 17, 2020

Copy link to clipboard

Copied

Hi,

thanks for the response it works fine.

 

Regards,

 

Nithu

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
May 17, 2020 0
New Here ,
Nov 05, 2020

Copy link to clipboard

Copied

 

I am a beginner to develop plugin in indesign.

I need to pass a result from JSX code to C++ plugin code.

 

I know jsx but i don't know what write in jsx to pass te result.

Can you give me an example of javascript code that return a result to C++ please ?

 

Thanks

Paulo

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 05, 2020 0