--获取文件夹路径
set sourceFolder to choose folder with prompt "请选择文件夹"
--获取文件列表
tell application "Finder"
set fileList to every file of sourceFolder as alias list
end tell
--随机排序
set fileList to paragraphs of (do shell script "echo " & quoted form of (paragraphs of (run script "set theList to " & (quoted form of (do shell script "printf %s " & (quoted form of (fileList as text))))) & " | perl -MList::Util -e 'print List::Util::shuffle();'")) as text
--创建输出文件
set outputFilePath to quoted form of (posix path of (choose file name with prompt "请选择输出文件名"))
--写入随机排序后的文件名
do shell script "echo " & quoted form of (fileList as text) & " > " & outputFilePath
此脚本会要求用户选择源文件夹,并随机对文件名进行排序,并创建一个随机顺序的输出文件。注意,这个脚本需要用户选择输入和输出文件名和路径。