问题描述
我正在编写一个简单的 AppleScript 来制作 iMovie 项目文件的副本.我已将此属性添加到脚本中:
I'm working on a simple AppleScript to make a copy of an iMovie project file. I have added this property to the script:
property iMovieProjects : alias (home directory of (system info) as string) & "Movies:iMovie Projects"
这给了我错误
文件别名 Macintosh HD:Users:我的用户名:Movies:iMovie Projects of not found
正确的路径是什么?我试过 iMovie Project.localized 但这也不起作用.
What's the correct path? I tried iMovie Project.localized but that doesn't work either.
推荐答案
试试这个,看来你需要使用 Finder.此外,我还对获取主路径进行了一些简化.
Try this, looks like you need to use the Finder. Also i added a little simplification on getting the home path.
property iMovieProjects : ""
tell application "Finder" to set iMovieProjects to alias ((home as string) & "Movies:iMovie Projects")
编辑:这是一种不使用 Finder 的单行解决方案,基于 mklement0 & 的想法.regulus6633
property iMovieProjects : alias ((path to movies folder as text) & "iMovie Projects.localized")
看起来这个文件夹是某种特殊的包类型文件夹,这就是为什么我们需要查找器来正确解析它.使用其完整的 .localized 名称可以解决它.
It appears this folder is some kind of special bundle type folder and thats why we were needing the finder to parse it correctly. Using its full .localized name resolves it.
这篇关于在 AppleScript 中使用的 iMovie Projects 文件夹的正确路径是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!