Copy link to clipboard
Copied
Hi,
I am using DispatchScriptRunner to call some jsx code. I would like the jsx code to return a value to my C plugin. While opening the InDesign it shows an error message as no such file exist in the path.Whether I should modifies this code. Please guide me.
do {
ScriptRecordData arg;
ScriptData script;
IDFile f(PMString("Desktop:sample script.jsx"));
script.SetFile(f);
ScriptData result;
PMString errorString;
InterfacePtr<IScriptManager> scriptManager(Utils<IScriptUtils>()->QueryScriptManager(kJavaScriptMgrBoss));
InterfacePtr<IScriptRunner> scriptRunner(scriptManager, UseDefaultIID());
Utils<IScriptUtils>()->DispatchScriptRunner(scriptRunner, script,arg, result,errorString, kTrue);
PMString retval;
result.GetPMString(retval);
CAlert::InformationAlert(retval);
} while (false);
Paths are platform dependent, the code snippet that you copied was written for a MAC and hence used a HFS path notation, even then you messed the path while editing it. HFS path starts with Macintosh HD: but you have removed all that so this is never gonna fly.
If you have to run this code on WIN the path changes as per WIN conventions. Atleast read the sdk documentation.
-Manan
Copy link to clipboard
Copied
Well, where is the script (jsx) file exactly?
Copy link to clipboard
Copied
I have placed the jsx file in the desktop and hereby I'll attach the exact location (C:\Users\Nithu Sathish\Desktop)
Copy link to clipboard
Copied
I have called the JavaScript using dispatcher in Windows.And thanks for the response to call the script files.
IDFile f(PMString("C:\\Users\\Nithu Sathish\\Desktop\\sample_script.jsx"));
Copy link to clipboard
Copied
Paths are platform dependent, the code snippet that you copied was written for a MAC and hence used a HFS path notation, even then you messed the path while editing it. HFS path starts with Macintosh HD: but you have removed all that so this is never gonna fly.
If you have to run this code on WIN the path changes as per WIN conventions. Atleast read the sdk documentation.
-Manan
Copy link to clipboard
Copied
Hello
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
Copy link to clipboard
Copied
Hi Paulo,
There is nothing special to write on the jsx end, you need to return the value as you normally do. Handling the return value has to be done on the C++ plugin end. I have written a sample snippet of C++ code for getting the string return value from jsx in the following post, have a look at it
https://community.adobe.com/t5/indesign/dispatchscriptrunner-return-values/td-p/10898739?page=1
-Manan