Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

How to open a file in Photoshop with javascript

$
0
0

HI!

 

I want to open a file/image with a button click in an extension, in photoshop >> javascript. 

 

Possibly with relative path  to the extension file (it have to work on several different computers)

 

I tried several scripts:

===================================================================================

function somename(){


#target photoshop

var fileRef = "C:\\Users\\Username\\Desktop\\scripting\\image.png"     // I tried several differnet syntay about the path >> / \  \\ etc. etc.

var doc = open(fileRef);
}

================  OR  ==================================================================

function somename2(){


#target photoshop

var fileRef = new File( ~/desktop/scripting/image.png )     // I tried several differnet syntay about the path >> / \  \\ etc. etc.

app.open(fileRef)
}

======================================================

I know these paths are absolute but >> None of them had work so far


Any ideas?


ps: im new to this >> please be specific or provide some example :-)  thanks!


Viewing all articles
Browse latest Browse all 12244

Trending Articles