Applescript包文件夹

Applescript包文件夹,applescript,Applescript,我正在尝试将文件夹移动到程序包文件夹(扩展名为.tblk的文件夹) 代码: 错误: Finder出现错误:无法创建文件夹的文档文件“Package.tblk” “桌面”文件夹“craibuc”文件夹“用户”启动盘进入 键入文件夹 如果此行: set thePackage to make new folder at theFolder with properties {name:"package.tblk"} 更改为: set thePackage to make new folder at t

我正在尝试将文件夹移动到程序包文件夹(扩展名为
.tblk
的文件夹)

代码:

错误:

Finder出现错误:无法创建文件夹的文档文件“Package.tblk” “桌面”文件夹“craibuc”文件夹“用户”启动盘进入 键入文件夹

如果此行:

set thePackage to make new folder at theFolder with properties {name:"package.tblk"}
更改为:

set thePackage to make new folder at theFolder with properties {name:"package"}
然后脚本按预期工作


有更好的方法处理这些类型的文件夹吗?

重构代码,以便在其他工作完成后创建包。更改文件夹扩展名后,使用别名保留文件引用:

tell application "Finder"

  set theFolder to (choose folder with prompt "Choose source folder" default location (path to downloads folder))

  set theResources to make new folder at theFolder with properties {name:"Resources"}

  set theContents to make new folder at theFolder with properties {name:"Contents"}
  move theResources to theContents

  set thePackage to make new folder at theFolder with properties {name:"Package"}
  move theContents to thePackage

  set thePackageAlias to thePackage as alias
  set the name extension of thePackageAlias to "tblk"

  set theConfigurations to (choose folder with prompt "Choose destination folder" default location (path to desktop folder))

  move thePackageAlias to theConfigurations

end tell
tell application "Finder"

  set theFolder to (choose folder with prompt "Choose source folder" default location (path to downloads folder))

  set theResources to make new folder at theFolder with properties {name:"Resources"}

  set theContents to make new folder at theFolder with properties {name:"Contents"}
  move theResources to theContents

  set thePackage to make new folder at theFolder with properties {name:"Package"}
  move theContents to thePackage

  set thePackageAlias to thePackage as alias
  set the name extension of thePackageAlias to "tblk"

  set theConfigurations to (choose folder with prompt "Choose destination folder" default location (path to desktop folder))

  move thePackageAlias to theConfigurations

end tell