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

DispatchScriptRunner return JavaScript values

Explorer ,
May 25, 2020 May 25, 2020

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);

 

 

 

Nithu_S_0-1590471533613.png

 

Nithu
TOPICS
Scripting , SDK

Views

993

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
community guidelines

correct answers 1 Correct answer

Community Expert , May 26, 2020 May 26, 2020

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

Votes

Translate

Translate
LEGEND ,
May 25, 2020 May 25, 2020

Copy link to clipboard

Copied

Well, where is the script (jsx) file exactly? 

Votes

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
community guidelines
Explorer ,
May 26, 2020 May 26, 2020

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)

Nithu

Votes

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
community guidelines
Explorer ,
May 28, 2020 May 28, 2020

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"));

Nithu

Votes

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
community guidelines
Community Expert ,
May 26, 2020 May 26, 2020

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

Votes

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
community guidelines
New Here ,
Nov 05, 2020 Nov 05, 2020

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

Votes

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
community guidelines
Community Expert ,
Nov 06, 2020 Nov 06, 2020

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines