Copy link to clipboard
Copied
Hi everybody,
I've been working on this for close to a day. I can't get a file to open in Photoshop no matter what I try to do with something thatI would imagine is relatievly straight-forward.
This is the script I'm using in VSCode:
open(File(fileRef))
Copy link to clipboard
Copied
open(File(fileRef))
Copy link to clipboard
Copied
Awesome, thank you!
(They should have that on Pg. 29 of the manual instead.)
Copy link to clipboard
Copied
I found 2 mistakes in your code:
- you tried to open a path (filePath)
- you used not an path object but string
btw if it solves the problem mark the solution as correct 😉
Copy link to clipboard
Copied
Yes, it fixed the problem, thank you.
I thought I might be running into a datatype issue of some kind but it wasn't clear entirely what I was doing wrong. I managed to get an alert to tell me it was a string, so I tried to eval() it hoping it would 'get it'...no dice.
So I needed to declare the File object by location reference, then pass the reference to the open command which is part of that objects method set. They explain that in the scripting guide, but it's example didn't work, yours did, strange.
// works
var docRef = open(File(fileRef));
//does not
var docRef = app.open(fileRef);
Copy link to clipboard
Copied
You simply missed out the File part and parentheses in the manual on said page 29.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now