Simple script... not working

As a complete newbie when it comes to AppleScript, I can’t understand what’s happening.
For example I want to open an image using Preview. I get a warning from Preview saying:

“The file “Feed Cover.jpg” couldn’t be opened because you don’t have permission to view it.
To view or change permissions, select the item in the Finder and choose File > Get Info.”
Also, at the bottom of the script editor where it says “result” I get “missing value”.

But I can open the file manually.
And here’s what’s weird: if the file was just copied from another location to the destination (let’s say the destination is the Desktop) and I’ve never opened it on the Desktop, I get that error. Once I go and I manually open the file, it opens, and then if I run the script again, now it opens it without an issue…
Can someone explain what’s happening? It seems that opening the file “unlocks it”? What’s going on?

Another issue:
I’m trying to open a PSD file with Photoshop, but it doesn’t open it. When I try with Preview, it opens. Maybe the issue is that the app is inside a folder inside the Applications folder? So instead of being in the root of Applications, it’s Applications > Adobe Photoshop 2020 > Adobe Photoshop 2020.app
If that’s the issue, how can I reference it to the file inside the folder?

This is my code so far:

tell application "Adobe Photoshop 2020" to open "Users:dannywyatt:Desktop:Cover Artwork - BeatNameHere.psd"

Model: MacBook Pro (13-inch, Mid 2012)
AppleScript: 2.11 (208)
Browser: Firefox 99.0
Operating System: macOS 12

I’m not sure how it works with Preview when the file path is missing the disk name

I’m assuming the name of your hard disk is “Macintosh HD”

so the hfs file path would be “Macintosh HD:Users:dannywyatt:Desktop:Cover Artwork - BeatNameHere.psd”


tell application "Adobe Photoshop 2020" to open "Macintosh HD:Users:dannywyatt:Desktop:Cover Artwork - BeatNameHere.psd"

Hi Robert,

Thank you for your reply.
Unfortunately, that didn’t change the behavior.
I am able to open the file using Preview, but not Photoshop.
If Photoshop is closed and I run the script, it opens the app, but not the file.
So weird…
It doesn’t even show any error.

I tried with another program, Affinity Designer, and at least it showed me an error saying it couldn’t open that file. It said:
“Failed to open PSD file. /Users/dannywyatt/Desktop/Cover Artwork - BeatNameHere.psd
The file was not found.”

Again, it’s super weird, because I am able to open that same file both with Photoshop and Affinity Designer if I do it manually. It seems that there’s some issue when it comes to the script, but not when I try to open the exact same file using Preview…
Go figure…

Hi. You need a file specifier (or the path needs to point to an alias), otherwise, what you’re attempting to open is literally text. Unless this has just recently changed in a point update, I don’t believe any Affinity products have scripting support.

tell application "Adobe Photoshop 2020" to open file ((path to desktop as text) & ":Cover Artwork - BeatNameHere.psd")