gpt4 book ai didi

macos - 使用 AppleScript 创建 Finder 别名

转载 作者:行者123 更新时间:2023-12-04 16:49:53 26 4
gpt4 key购买 nike

set folder_1 to text returned of (display dialog "Create Folders:" default answer "Type Here")
set folder_2 to "new_" & folder_1

set loc1 to ":path1"
set loc2 to ":path2"


tell application "Finder"
set newfo1 to make new folder at loc1 with properties {name:folder_1}
make new folder at newfo1 with properties {name:"new folder"}
make new folder at newfo1 with properties {name:"new folder"}
make new folder at newfo1 with properties {name:"new folder"}
make new folder at newfo1 with properties {name:"new folder"}

set newfo2 to make new folder at loc2 with properties {name:folder_2}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}
make new folder at newfo2 with properties {name:"new folder"}

make alias at folder_1 to folder_2

end tell

任何人都可以阐明如何在上面的代码中创建别名。我正在尝试在 {name:folder_1} 中创建 {name:folder_2} 的别名,但使用该变量我得到一个 Finder 出现错误:AppleEvent处理程序失败。有人能帮忙吗?

非常感谢

最佳答案

看起来您需要做的就是更改您的make alias 语句以使用新创建的文件夹objects:

make alias at newfo1 to newfo2

请注意,您的代码不会处理您创建的任何文件夹已经存在的情况(在这种情况下,您会收到 错误“操作无法完成,因为已经有一个项目那个名字。”数字 -48).

关于macos - 使用 AppleScript 创建 Finder 别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22799334/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com