Skip to main content
Participating Frequently
May 18, 2016
Answered

How to make a PS action choose "any" path?

  • May 18, 2016
  • 2 replies
  • 3398 views

Hi community,

Does anyone know of a way to make a PS action choose "any" path? There is only ever one path in the file but it may not always be named the same.

We are sending hundreds of files weekly to a clipping path provider, sometimes they name the only path they make "Path 1" sometimes "path 1" or "work path".

Since the company employs hundreds of PS operators it's inevitable that the paths may sometimes have different names, but I can't afford having my actions stop because of this.

So, I want to make it so that PS choose the only path there is in the file, no matter what it's name, is this at all possible?

Here is an example:

  "E-COMMERCE   Set background to 5% black    TEXT select Selectˇˇˇˇ null nullobj  name Path Path 1  TEXT set Setˇˇˇˇ null nullobj  prop ChnlfselT   obj  Enmr PathOrdnTrgtVrsnlong  vectorMaskParamsbool   TEXT inverse Inverse  TEXT fill Fillˇˇˇˇ null UsngenumFlCnBlckOpctUntF#Prc@ Md  enumBlnMNrml   TEXT set Setˇˇˇˇ null nullobj  prop ChnlfselT   enumOrdnNone"

I want to change "Path 1" in red above to "any" path...

Thanks in advance!

Magnus Eklof

This topic has been closed for replies.
Correct answer Chuck Uebele

If there is only one path, this will select that path:

var doc = activeDocument

doc.pathItems[0].select()

2 replies

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
May 18, 2016

If there is only one path, this will select that path:

var doc = activeDocument

doc.pathItems[0].select()

Participating Frequently
May 18, 2016

Hi Chuck, and thanks!

I must admit that your answer made me realize that I'm in over my head though, I have no idea where to insert the snippets you provided.

Here is a link to an xml-file derived from the PS action file in question;

https://dl.dropboxusercontent.com/u/40102405/E-COMMERCE.xml

And the original PS action;

https://dl.dropboxusercontent.com/u/40102405/E-COMMERCE.atn

If you, or anyone, have any suggestions that could solve my dilemma the beers are on me next time you find yourself in Gothenburg, Sweden!

Cheers

Magnus

c.pfaffenbichler
Community Expert
Community Expert
May 18, 2016

Save the lines Chuck Uebele provided as a jsx-file (from ExtendScript Toolkit or a text editor) into the Presets/Scripts-folder beside the Photoshop app or exe.

After starting Photoshop it should be available under File > Scripts > … and you should be able to insert it into an Action.

JJMack
Community Expert
Community Expert
May 18, 2016

Actions have limited abilities and can not use logic.  Action steps that deal with files may be made interactive so the user can resolve a files location.

With logic scripting can change file paths however you would need to program that logic into the script.   There is no magic there is no "any" path files have a specific path.  File name do not need to be unique  You need  the correct path to get to the correct file with any given file name.

JJMack
Participating Frequently
May 18, 2016

Thanks JJMack!

As this particular action is being run on an unsupervised server processing 50,000+ images per annum, I'm trying to find any solution at all to minimize human interaction.

Thanks again.

Magnus