查找器错误:Apple 事件处理程序失败



我正在尝试编写一个苹果脚本来从剪贴板中提取字符串,解析它并在满足条件时创建一个文件夹。

字符串始终采用"yyyymmdd.hhmmss.abc.xyz"格式

代码粘贴如下:

set datevar to item 1 of my Splitstring(the clipboard, ".")
set yearvar to (datevar / 10000) as integer
on Splitstring(stringvar, del)
    set defaultdel to AppleScript's text item delimiters
    set AppleScript's text item delimiters to del
    set arrayvar to every text item of the stringvar
    set AppleScript's text item delimiters to defaultdel
    return arrayvar
end Splitstring
.
.
.
.
.
.
if yearvar < 2002 then
    set tempvar to "/Volumes/My Passport/Cygnus-CME/Cycle-22-Min/Slow_CME/"
    set loc to POSIX path of tempvar
    tell application "Finder"
        make new folder at loc with properties {name:datevar} # ---- Error location
    end tell
end if

如果路径是其他路径,则创建新文件夹的命令工作正常。我已经验证了外部HD是否已安装,并且我的帐户的权限是r&w。

我做错了什么?我设置外部HD路径的方式有问题吗?

感谢您的帮助!

Finder 需要 HFS 路径(冒号分隔)。HFS 路径始终以磁盘名称开头,从不以磁盘名称开头Volumes

set loc to "My Passport:Cygnus-CME:Cycle-22-Min:Slow_CME:"
tell application "Finder"
    make new folder at folder loc with properties {name:datevar}
end tell

set loc to POSIX file of tempvar
tell application "Finder"
   make new folder at loc with properties {name:datevar}
end tell

最新更新