Finder error: Apple event handler failed
Finder error: Apple event handler failed
我正在尝试编写一个 applescript 从剪贴板中提取一个字符串,解析它并在满足条件时创建一个文件夹。
字符串始终采用 "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
如果路径是其他路径,创建新文件夹的命令工作正常。我已验证外置硬盘已挂载,我的账号权限为r&w
我做错了什么?是我设置外置硬盘路径的方式有问题吗?
感谢您的帮助!
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
我正在尝试编写一个 applescript 从剪贴板中提取一个字符串,解析它并在满足条件时创建一个文件夹。
字符串始终采用 "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
如果路径是其他路径,创建新文件夹的命令工作正常。我已验证外置硬盘已挂载,我的账号权限为r&w
我做错了什么?是我设置外置硬盘路径的方式有问题吗?
感谢您的帮助!
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