Skip to main content
Inspiring
July 30, 2010
Question

IndexOf in doc path in Photoshop CS4 js

  • July 30, 2010
  • 1 reply
  • 1067 views

Hi,

I need to get to a part of my doc path and the indexOf doesn't work for some reason:

var mySeriesSplit = myDocPath.indexOf ("Series");

Your help is greatly appreceited.

Yulia

This topic has been closed for replies.

1 reply

Inspiring
July 30, 2010

indexOf is a String method. Document.path returns a File object. You need to convert the file object to a string with either decodeURI or one of the File properties like fsName, fullName, etc.

var f = app.activeDocument.path;
decodeURI(f).indexOf("Series");

// or

var f = app.activeDocument.path.fsName;
f.indexOf("Series");

YuliaartAuthor
Inspiring
July 30, 2010

Thank you, Michael, it works beautifully.

Yulia