app.path will refer to Photoshop, and not the scripting folder. is that where your file is? Not really a good place for an image file. if the image file is needed for your script, you can make a folder for it in presets, maybe call it "Images." I prefer directly naming a path.
Hi Chuck, thanks for getting responding.
The file could be anywhere on my local hard drive. I had it in the script directory because I was thinking it would be easier for testing to keep in in the same directory. For an example, what would be the correct syntax used to get to a file in documents/working/jobs/client/file.psd ? I haven't had any luck finding the correct way to target this.
Thanks, ~ Joe D
I believe, using a "~" will refer to the users Library folder on a mac.
The tilde "~" won't help me if it starts my path down the user Library. I need it to start at Document level at least. I have included the path to my file below.
var fileRef = File(app.path + "/Users/joe/Documents/Practice/file.psd")
How would one target this file correctly? I currently get an error that the file does not exist.
Thanks, ~ Joe D
It should be:
So odd. I pasted your path into the string and I still get an error. There must be something else that I am missing.?
var fileRef = new File('~/Documents/working/jobs/client/file.psd');
Try the above. I'm not sure if capitalization matters.
Umm, capitalization doesn't matter, nor does the new.
Your suggestion works:
var fileRef = new File('~/Documents/Working/jobs/client/file.psd')
However, it is different than the original code that I had been using, which is:
var fileRef = File(app.path + '~/Documents/Working/jobs/client/file.psd')
Capitals or not has no effect.
I have been using File(app.path +'~/Documents...
Any thoughts on why that isn't working?
app.path refers to the Photoshop program folder. The ~ refers to the users folder. Two completely separate things.
Chuck thanks for your time. I figured it was something simple like that I just need a bit of guidance in order to see it.
~ Joe D
check this out
var selectedPSD = File.openDialog("Select a PSD file to open" , "Select:*.psd");
if (selectedPSD!=undefined) app.open(selectedPSD);
Hi JJMack, this works great. Thanks for sending it along.
~ Joe D