how to rename using applescript in monterey?

In High sierra, I made a working applescript that bulk renames and moves files. In monterey, not only does it not work, but apparently I can't rename anything? I made something simple like the below script and even that gives me a 10003 error (access not allowed). is there a permission somewhere I need to turn on?

tell application "Finder"

set theFile to "hello world.txt"
set theName to "hello"
set the {name} of file theFile to theName & ".txt"

end tell

It’s hard to say what’s going on here because you only posted a snippet of your script. So I fleshed it out to something I can run, namely:

choose file
set f to result
tell application "Finder"
    set name of f to "Hello Cruel World.txt"
end tell

When I run this and choose a file called Hello World.txt in my home directory, the file ends up being renamed to Hello Cruel World.txt.

This is on macOS 12.6.

Share and Enjoy

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

thanks! I figured out from this that I couldn't set and choose in the same line, that was messing things up. I do still have a problem now though, the script runs and works on some but not all of the files. I elaborated on the other thread. Could you please take a look?

how to rename using applescript in monterey?
 
 
Q