Applescript Finder permissions issue macos 12.3.1

Hello,

This simple Applescript

tell application "Finder"
	open file "a907.jpg" of folder "Photoshopped" of folder "CalBodfish" of folder "Users" of disk "Macintosh HD"
end tell

results in an error that says

The file "a907.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.

This script worked as expected in previous versions of macos, at least thru 12.0.

If the file is opened by double-clicking on it, the Applescript works as expected, for that particular file.

Much obliged if anyone here can help.

I'm having the same problem. I created a fresh, vanilla plain text file in TextEdit. Then ran this code:

set open_this to "MyMac:Users:MyHome:Desktop:MyTest.txt" tell application "Finder" to open open_this

I get this error: "The document "MyTest.txt" could not be opened. You don't have permission. To view or change permissions, select the item in the Finder and choose File > Get Info"

So, I switched to this code:

set open_this to "/Users/MyHome/Desktop/MyTest.txt" tell application "System Events" to open file open_this

That produced a new error: "The document "/Users/MyHome/Desktop/MyTest.txt" could not be opened. The file does not exist."

This seems to be a variant of the bug in macOS 12.3 which prevented using Finder to open files from within AppleScript. Switching to system Events was a workaround but now, even that is not working.

I’ve been hit by this myself. I never really dug into the details because I needed a workaround urgently. And that workaround was to invoke the open command-line tool using do shell script.

set fullPath to … a Posix-style path …
do shell script "open " & quoted form of fullPath

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

This behaviour seems not to occur in macOS 12.4 beta (Build 21F79). Not sure it has been fixed in all situations.

Applescript Finder permissions issue macos 12.3.1
 
 
Q