Accessing file

The Applescript documentation includes the following example: Listing 15-14AppleScript: Coercing a string to an alias set theFilePath to "Macintosh HD:Users:yourUserName:Desktop:My File.txt" set theFilePath to theFilePath as alias

When I try to run the following script on my iMac running Big Sur 11.5.2

tell application "Finder" activate set theFilePath to "InternalDrive:Users:Shared:Previously Relocated Items:Security:Photos & Scans:BakerFamily:ArmyFence.psd" set theFilePath to theFilePath as alias end tell return theFilePath

I get to following error message:

error "Can’t make "InternalDrive:Users:Shared:Previously Relocated Items:Security:Photos & Scans:BakerFamily:ArmyFence.psd" into type alias." number -1700 from "InternalDrive:Users:Shared:Previously Relocated Items:Security:Photos & Scans:BakerFamily:ArmyFence.psd" to alias

Am I doing something wrong or has something changed? I have also noticed that Applescripts I used routinely to change to labels on files until a month or so ago now no longer work.

Replies

Apparently the problem was that I had left the files in a Security folder in Previously Relocated Items where they were moved during an OS update. Once I move the files out of that folder to some other "normal" folder, the script works. I have yet to find a satisfying explanation of what the "Security" folder is for and why the files were moved there when i upgraded, but...