AppleScript在创建文件夹时引发错误
好吧,也许我很蠢,但为什么会这样? 这是我的密码AppleScript在创建文件夹时引发错误,applescript,Applescript,好吧,也许我很蠢,但为什么会这样? 这是我的密码 set openedFile to (choose file with prompt "Select a file to read:" of type {"PNG"}) tell application "Finder" set parentFolder to POSIX path of (parent of openedFile as text) set icFolder to make new folder at paren
set openedFile to (choose file with prompt "Select a file to read:" of type {"PNG"})
tell application "Finder"
set parentFolder to POSIX path of (parent of openedFile as text)
set icFolder to make new folder at parentFolder with properties {name:"resized imgs"}
end tell
当我尝试运行它并选择一个文件时,我得到以下信息:
错误“Finder出现错误:AppleeEvent处理程序失败。”编号-10000
怎么了
父文件夹行导致了您的问题。首先,没有“parent”这样的命令。查找器有命令“container”来获取父文件夹。此外,使用“POSIX文件”和“作为文本”也会把事情搞砸。openedFile已经是Finder的正确格式,因此不需要强制将其转换为任何其他形式 因此,只需将parentFolder行更改为此。祝你好运
set parentFolder to container of openedFile
我自己想出来的:
set parentFolder to container of openedFile
set icnsFolder to (make new folder at parentFolder with properties {name:"resizedicns"}) as alias
set ic512_2x to duplicate openedFile to icnsFolder
我之前尝试过这个,但又一次得到了这样的错误:“无法将应用程序”Finder“的”class sdsk“用户”的“类cfol”的“类cfol”的“类cfol”的“文档”的“类cfol”的“类cfol”的“开发”的“类cfol”的“类cfol”的“文档”的“类cfol”的“开发”的“类cfol”文档”的“编号-1700”“类别cfol”的“michaelmullins”的“类别cfol”的“用户”的“类别sdsk”的“用户”的列表、记录或文本