Highlighted

Calling jsx to c++

Explorer ,
Jul 07, 2020

Copy link to clipboard

Copied

Hi,

 

I have tried this code to fetch the image count values from javascript to c++. But it doesn't provide the desired values.Please guide me for working on this..

 

InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString importscript;
importscript.Append("var imagecount = app.activeDocument.allGraphics.length;");
importscript.Append("var images =app.scriptArgs.setValue(\"imagecount\",String(imagecount));");

importscript.Append("alert(String(images));");

PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, importscript);
Utils<IScriptArgs>()->Clear();

 

Regards,

-Monisha
TOPICS
How to, Server developers

Views

25

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

Calling jsx to c++

Explorer ,
Jul 07, 2020

Copy link to clipboard

Copied

Hi,

 

I have tried this code to fetch the image count values from javascript to c++. But it doesn't provide the desired values.Please guide me for working on this..

 

InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
PMString importscript;
importscript.Append("var imagecount = app.activeDocument.allGraphics.length;");
importscript.Append("var images =app.scriptArgs.setValue(\"imagecount\",String(imagecount));");

importscript.Append("alert(String(images));");

PMString engineName("myengine");
int32 errorCode = Utils<IExtendScriptUtils>()->RunScriptInEngine(engineName, importscript);
Utils<IScriptArgs>()->Clear();

 

Regards,

-Monisha
TOPICS
How to, Server developers

Views

26

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
Jul 07, 2020 0

Have something to add?

Join the conversation