Problems with Applescript "set hidden extension" in a Quick Action
I often need to change the "hide extension" attribute of (downloaded) pdfs so that the extension displays in Finder. I'd written a script which does what I want it to do. It would be quicker and more convenient to have a Quick Action in Finder to do the same thing but I can't seem to get it to work.
Obviously in a Quick Action I don't need to tell Finder to do anything so ignoring that bit, my working script is effectively just creating a list and running "set hidden extension" to false on all the items in it.
set filesToModify to (choose file with multiple selections allowed)
repeat with fileItems in filesToModify
set extension hidden of fileItems to false
end repeat
Creating a Quick Action with Automator I've tried to keep the same code with essential modifications only. The code below doesn't include the return or end run statements because I know the error happens before those are reached.
on run {input, parameters}
set filesToModify to input as list
repeat with fileItems in filesToModify
set extension hidden of fileItems to false
end repeat
Creating the list seems to work ("as list" may be redundant). I have checked that after that line it is really a list of aliases of the files selected before the Quick Action is run.
The loop also starts as expected.
The problem seems to be with the "set extension hidden" line which results in a stack overflow. It makes not difference whether one file or multiple files have been selected.
Can anyone tell me what I'm doing wrong?