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

Photoshop script return error on indexOf()

Participant ,
Sep 26, 2015 Sep 26, 2015

Copy link to clipboard

Copied

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

Views

377

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
no replies

Have something to add?

Join the conversation