Copy link to clipboard
Copied
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.:
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
The idea that I use in the xtools installer and else where is this:
1) Convert the action file to XML.
2) Package the XML file and the apps/ActionFileFromXML script with your stuff.
3) An installer script will do a 'replace' (or whatever) on the XML file so that the paths are converted to whatever is needed.
4) The new XML is saved and then converted to a .atn file which is then loaded.
There is an xtools forum at ps-scripts.com that may have some info in addition to the PDF file that comes with the package.
-X