打開自動操作.app
image.png
添加一個工作流 ,選取應用程序,在左邊欄
–資源庫
–實用工具
中選擇 運行AppleScript `,將下方代碼替換掉默認代碼
image.png
image.png
代碼如下:
on run {input, parameters}
set titleStr to "請輸入創(chuàng)建的文件名"
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