gpt4 book ai didi

macos - 如何从命令行创建 Macintosh Finder 别名?

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

我正在尝试从命令行或 Python 程序创建 Finder 别名。我搜索了网络[1][2][3]并找到了这段applescript:

$ osascript -e 'tell application "Finder" to make new alias at POSIX file "/Users/vy32/cyber.txt" to POSIX file "/Users/vy32/a/deeper/directory/cyber.txt"'

不幸的是,它给了我这个错误:

29:133: execution error: Finder got an error: AppleEvent handler failed. (-10000)

[1] http://hayne.net/MacDev/Bash/make_alias

[2] https://discussions.apple.com/thread/1041148?start=0&tstart=0

[3] http://hintsforums.macworld.com/showthread.php?t=27642

我做错了什么?

最佳答案

关于您的消息,请尝试查看 Console.app。可能是源文件不存在。当我尝试使 Xcode 4.3+ 应用程序可见时,这对我很有帮助。我找到了工作代码:

$ osascript -e 'tell application "Finder" to make alias file to POSIX file "/file/to/make/link/from" at POSIX file "/folder/where/to/make/link"'

例如:

$ osascript -e 'tell application "Finder" to make alias file to POSIX file "/Applications/Xcode.app/Contents/Applications/OpenGL ES Performance Detective.app" at POSIX file "/Users/mylogin/Applications"'

关于macos - 如何从命令行创建 Macintosh Finder 别名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7072208/

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