Skip to main content
Participant
April 15, 2009
Question

Use Relative Path for Photoshop Action?

  • April 15, 2009
  • 1 reply
  • 11126 views

I have a Photoshop Action that is programmed to open an existing file located in a specific directory.  The path to this directory is an absolute path, i.e.:

C:\Program Files\Photoshop Actions\filename.jpg
As long as the Action can find the file in the specified absolute path, everything works fine.
My problem is that if someone tries to run this Action on a different computer (like a Mac), the path specified in the action does not exist and the Action will not work.
The simple solution to this would be to make the action open the file located at a relative path.  This way no matter what computer the action is run on, it will always be able to find the file.
Unfortunately, I don't think Photoshop Actions allow relative paths.  Does anyone know if using a relative path in an action is possible?
Failing this, how would I use a Photoshop Script to somehow direct the Action to find the correct location of the file?  Or is there a better solution?

This topic has been closed for replies.

1 reply

Paul Riggott
Inspiring
April 15, 2009

One way would be to have the script open the picture from a known folder (home) and then call the action to run on the selected picture IE:

#target photoshop
var myFile = File("~/myPic.jpg");
open (myFile);
doAction(actionName, actionSet);

benwhutAuthor
Participant
April 15, 2009

Thanks for the quick response.  So does this mean if I'm distributing this Action and Script to other users that I would have to make sure that the file "myPic.jpg" is copied into a folder relative to the user's home folder?  Would this work for both PCs and Macs? 

Would it be possible to use a relative path instead of the home folder?  Like:

var myFile = File("images/myPic.jpg");

Would this work?

benwhutAuthor
Participant
April 15, 2009

You should have a look at Xbytor's xtools http://ps-scripts.com/bb/viewtopic.php?t=2333

It has a javascript that you could adapt that would allow any actions that have file paths changed when distributing actions. The end user would only have to run the install script once to update the action to the new path.


Thanks Michael.  I will take a look at this.  At first glance, there's not a lot of documentation.  Is it difficult to use?  Anything you can suggest to point me in the right direction?