下面是一个使用Automator的AppleScript脚本示例,可以根据文件名创建文件夹并将文件移动到文件夹中:
on run {input, parameters}
repeat with theFile in input
tell application "Finder"
set theFolder to make new folder at (container of theFile) with properties {name:name of theFile}
move theFile to theFolder
end tell
end repeat
return input
end run
请注意,此脚本将在文件所在的文件夹中创建新文件夹,并将文件移动到新文件夹中。如果要将文件移动到其他位置,可以修改代码中的container of theFile
。