Skip to main content
Naoki-Hada
Known Participant
June 27, 2018
Question

[Q] CSInterface.evalScript() reports "EvalScript error."

  • June 27, 2018
  • 2 replies
  • 7189 views

Hi all,

I'm not sure where is the problem and still in troubleshooting.

I wonder if anyone has workaround or any idea where I should check.

ExtendScript itself is working as expected. But when it is called from CEP's CSInterface.evalScript(), it causes "EvalScript error."

ExtendScript code is modified code from following.

Change value sample size

Changing Eyedropper's tools property value from CEP plugin.

In the project there's similar code used, but only these part has issue.

The above link's code's JSON has syntax issue. ExtendScript is OK. But JSONLint reported error. After fix, it still have issue.

I rewrote to ActionDescriptor without JSON data, it still have same issue (JSX is OK. CEP has issue.)

I appreciate any tips and advice.

Thank you,

Naoki

[Moved to Extensions/Add-ons Development forum by Mod]

This topic has been closed for replies.

2 replies

Participant
August 3, 2018

I am just beginning with Photoshop CEP extension development, and I also ran into the problem of evalScript() not providing any useful error messages or debug information.  The solution I decided on was to try to run the same code in the ExtendScript Toolkit as a standalone script.  For instance, if a particular evalScript call is causing problems, then you can output the exact parameters that you are calling it with in the JS / CEP panel, and then separately run the JSX code using those parameters in ExtendScript.  This way, you get more detailed error messages when the host-side code runs into something that it doesn't understand. 

Of course, for particularly complex or dynamic extensions, this may be impractical, but it at least gives you a way to debug some form of your host JSX file.

Ten A
Community Expert
Community Expert
June 30, 2018

I try to wrap all code in IIFE and call from my code editor extension. It's work fine in CC2018.

Naoki-Hada
Known Participant
July 2, 2018

Hi Ten A

Thank you very much for tips.

This posting was only Photoshop issue and posted on Photoshop Scripting forum.

The current framework (CEP + ExtendScript) was working fine for supporting multiple apps until added Photoshop's particular functionalities (RedEye and Eyedropper tool support).

The CEP framework is similar to following sample code.

CEP-Resources/CEP_7.x/Samples/CEP_HTML_Invisible_Extension-7.0 at master · Adobe-CEP/CEP-Resources · GitHub

At beginging of CEP's JavaScript, it is loading JSX as following.

csInterface.evalScript('$.evalFile("' + fullpath_fileName + '")');

At execution place was just using evalScript.

    csInterface.evalScript('jsx_func_in_jsx_file(' + passing_param + ')', function(response) {

        // handing response

    });

Other part of JSX functions are still working fine, but above new Photoshop function are not working and causing "EvalScript error".

The JSX function are working fine with ExtendScript.

So my question for this forum would be is there any way to get more detail info from CsInterface.evalScript() on "EvalScript error" case?

Of is it really blackbox?

Thank you,

Naoki

Trevor:
Legend
July 11, 2018

I do this with my JSX.js A Game Changer in Adobe HTML Extensions Development? | Creative-Scripts.com

See around line 438, the basic idea is to wrap the script with a try {} catch(e){} returning the e info you want.

You can see how this is used in my CSTK search for it there.