Skip to main content
Inspiring
September 15, 2015
Answered

How to get a file's absolute path into a photoshop extension?

  • September 15, 2015
  • 1 reply
  • 763 views

Hi there,

I am trying to submit a file via an input inside a Photoshop extension. But how can I get the absolute path to that file inside the computer?

Thanks in advance

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

I'm not sure what you mean by submitting a file. Do you want to open a file in PS or do need to declare the path for a supporting file for the extension? With javascript you would set a variable. In Win it would look something like:

var file = new File('/c/images/myfile.psd');

or

var myScript = new File(app.path + '/Presets/Scripts/myJavascript.jsx');

1 reply

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
September 16, 2015

I'm not sure what you mean by submitting a file. Do you want to open a file in PS or do need to declare the path for a supporting file for the extension? With javascript you would set a variable. In Win it would look something like:

var file = new File('/c/images/myfile.psd');

or

var myScript = new File(app.path + '/Presets/Scripts/myJavascript.jsx');

gespinhaAuthor
Inspiring
September 22, 2015

@Chuck Uebele Thanks

I have the following file structure:

test.psd

test.js

How can I console.log the contents of the "test.js" file inside a Photoshop extension (I have already got the extension running and console.loging on debug mode)? Can I use that method? Something like this perhaps:

    var app_path = app.activeDocument.path,

        file = new File(app_path + '/test.js');

    console.log(file);