I’m running Monterey 12.6 on a 2018 Mac mini and it hasn’t been fixed for me.
set theFile to (choose file)
tell application "Finder" to open theFile
--> The document “New Text File 1.txt” could not be opened. You don’t have permission.
I’m running Monterey 12.6 on a 2018 Mac mini and it hasn’t been fixed for me.
set theFile to (choose file)
tell application "Finder" to open theFile
--> The document “New Text File 1.txt” could not be opened. You don’t have permission.
Wow, thanks. Your code doesn’t work on my Catalina either without the word “file” before theFile, or set theFile to «class furl» first.
Nothing seems to work for me.
set theFile to (choose file)
tell application "Finder" to open file theFile
--> The document “New Text File 1.txt” could not be opened. You don’t have permission.
set theFile to (choose file) as text
tell application "Finder" to open file theFile
--> The document “New Text File 2.txt” could not be opened. You don’t have permission.
set theFile to (choose file) as «class furl»
tell application "Finder" to open theFile
--> The document New Text File 3.txt” could not be opened. You don’t have permission.
set theFile to (choose file)
tell application "Finder" to open theFile as «class furl»
--> The document “New Text File 4.txt” could not be opened. You don’t have permission.
Make sure to open the file first with Finder, if you get permission warning.
It does work for me to tell Finder to open files. Monterey 12.6.1
Here is a possible workaround not using AppleScriptObjC under Monterey 12.6.1:
-- open the file using its url property (must be coeced to alias)
tell application "Finder" to set theFile to make new file at (path to desktop)
tell application "Finder" to set theURL to URL of (theFile as alias)
open location theURL
-- check out if the file can be opened afterwards
delay 2
tell application "TextEdit" to close document 1 saving no
tell application "Finder" to open theFile
Let me know if it works for you.
It was partially fixed in 12.3.1, but I can’t recall the details—enough for my particular use case to function again. I’m on Ventura now.