打开自动操作.app

image.png
添加一个工作流 ,选取应用程序,在左边栏–资源库–实用工具中选择 运行AppleScript `,将下方代码替换掉默认代码

image.png

image.png
代码如下:
on run {input, parameters}
set titleStr to "请输入创建的文件名"
set btns to {"确定"}
display dialog titleStr buttons btns default button 1 default answer "new.txt"
set returnRecord to the result --获取返回的record类型的值
get the text returned of returnRecord -- 获取输入的文本
tell application "Finder"
set selection to make new file at (get insertion location) with properties {name:(get the text returned of returnRecord)}
end tell
return input
end run
关闭Automator,会提示你保存,保存到 应用程序文件夹,然后Finder 工具栏右键, 自定义, 把 New File.app 拖到工具栏的空白位置即可。点击一下,即可生成文本文件。

image.png

image.png