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?

Paul Riggott
Inspiring
April 15, 2009

No that would not work!

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

This would work on all systems. So long as the picture was put in the home folder.

You could have a folder off Home if you wanted

var myFile = File("~/images/myPic.jpg");
You would of course have the user copy the files into the correct places, or write an install script.