Highlighted

DispatchScriptRunner return JavaScript values

Explorer ,
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
Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

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

Topics

Scripting, SDK

Views

655

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

DispatchScriptRunner return JavaScript values

Explorer ,
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
Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

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

Topics

Scripting, SDK

Views

656

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
Most Valuable Participant ,
May 25, 2020

Copy link to clipboard

Copied

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

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...
Explorer ,
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

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...
Nithu_S LATEST
Explorer ,
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

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...
Adobe Community Professional ,
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

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