如何创建一个Macintosh查找别名通过命令行? [英] How do I create a Macintosh Finder Alias From the Command Line?

查看:348
本文介绍了如何创建一个Macintosh查找别名通过命令行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过命令行或Python程序创建一个Finder别名。我已经在网上搜索[1] [2] [3],发现这一点的AppleScript的:

I am trying to create a Finder Alias from the command line or from a Python program. I have searched the web[1][2][3] and found this bit of 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"'

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

Unfortunately, it gives me this error:

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

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

[2] <一个href=\"https://discussions.apple.com/thread/1041148?start=0&tstart=0\">https://discussions.apple.com/thread/1041148?start=0&tstart=0

[3] <一个href=\"http://hintsforums.macworld.com/showthread.php?t=27642\">http://hintsforums.macworld.com/showthread.php?t=27642

我在做什么错了?

推荐答案

关于你的消息,尝试看看Console.app。可能是源文件不存在。这可以帮助我,当我试图让X $ C $ç4.3+应用程序可见。我发现工作code:

about your message, try to look at Console.app. May be source file does not exists. This helps me when I try to make Xcode 4.3+ applications visible. I've found working code:

$ 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"'

这篇关于如何创建一个Macintosh查找别名通过命令行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆