我想将.exe文件扩展名与启动wine的shell脚本相关联。做这个的最好方式是什么?
从我收集的数据中,我需要创建一个将调用wine的AppleScript,但是如何在AppleScript中获取输入文件的名称呢?如果有更好的方法,请告诉我,但是据我所知,这是最好的方法。
最佳答案
您可以使用AppleScript应用程序执行此操作-将文件传递给打开处理程序,与小滴相同,例如:
on open theFiles
set arguments to ""
repeat with anItem in theFiles
set arguments to arguments & space & (quoted form of POSIX path of anItem)
end repeat
do shell script "/path/to/wine" & arguments
end open
要将特定的文档类型与您的应用程序相关联,您首先需要将信息添加到应用程序的信息属性列表( Info.plist )中,以告诉Launch Services它可以处理的文档类型。请参阅Apple的Document-Based Applications Overview(或查看其他应用程序中的设置)。
关于bash - OSX将Shell脚本与文件扩展名相关联吗?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7184987/