Skip to main content
Inspiring
September 26, 2015
Question

Photoshop script return error on indexOf()

  • September 26, 2015
  • 0 replies
  • 432 views

I have the following script inside Photoshop, which executes a function inside the Application and returns a "console.log" back to the Script page:

Inside the Script page

    var cs = new CSInterface(),

        arr = ['one', 'two', 'three'];

    cs.evalScript('one("' + arr.toString() + '")', function(e){

        console.log(e);

    });

Inside the Application

    function one(a){

        a = a.split(',');

        return a.indexOf('two');

    }

But for some reason, on the Script page it is returning an "Evalscript Error" inside the "console.log". I have managed to detect that it is actually coming from the "indexOf", but why? Its seems to work fine in a different context.

It returns the "a.length" and just the "a" but not an "a.indexOf()"?

Thanks in advance

This topic has been closed for replies.