Mac(二):AppleScript实现在当前位置创建文件

展示

可以结合 BetterAndBetter 进行快捷操作使用
在这里插入图片描述

源码

tell application "Finder" to set currentFolder to insertion location as alias
set newfilename to ""
display dialog "请输入完整的文件名" default answer newfilename buttons {
    
    "取消", "确定"} default button 2
if button returned of result is "确定" then
	set newfilename to text returned of the result
	set currentFile to POSIX path of currentFolder & newfilename
	do shell script "touch \"" & currentFile & "\";open \"" & currentFile & "\""
end if

猜你喜欢

转载自blog.csdn.net/weixin_43526371/article/details/114285219