Highlighted

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.1K

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.1K

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
Nithu_S LATEST
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