I have found this script and I would like to modify it to do what I expect it to do:
tell application "Finder"
set theFile to (choose file)
set name of theFile to "artwork.png"
end tell
So here’s what I need:
1 - I would like to create a Service out of this script so I can just access it when I right click the file
2 - I would like the script to be applied to the selected file, instead of asking me which file I want to rename.
The following works in Monterey and appears to work in Catalina:
Open the Automator app and select File > New then Quick Action.
At the upper-right corner after the heading “Workflow receives current”, select from the drop-down list “files and folders”. Then, after the heading “in”, select from the drop-down list “Finder.app”.
From the left pane, select and drag “Run AppleScript” to the right pane. Paste the script contained below into the right pane replacing all existing text. Double-check the contents of the script because Automator’s auto-complete may add unwanted text.
Save the Quick Action with whatever name is desired and quit Automator.
In a Finder window, select and right-click on a file. Scroll down the context menu to Quick Action and select the Quick Action script saved in 4 above. This should rename the selected file. The Quick Action script will also appear in the Finder > Services.
The script that I tested was:
on run {input}
tell application "Finder"
set name of (item 1 of input) to "artwork.png"
end tell
end run