As far as I can tell the standard applescript code for changing filenames is:
set name of my_file to "New_Name"
But when I use this inside a repeat loop (called by a folder action) I get a "Stack overflow" error. Here's the full code:
on adding folder items to this_folder after receiving these_items
try
repeat with this_item in these_items
set name of this_item to "New_Name"
end repeat
on error error_message number error_number
display dialog error_message buttons {"Cancel"} default button 1
end try
end adding folder items to
Has anyone come across this problem? Might it have anything to do with Mountain Lion?
Try:
tell application "System Events" to set name of this_item to "New_Name"