如何设置在Mac OS X中的特定文件类型的默认应用程序? [英] How to set default application for specific file types in Mac OS X?

查看:452
本文介绍了如何设置在Mac OS X中的特定文件类型的默认应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Mac OSX上的狮子,我米试图设置为特定的文件类型的默认应用程序。
使用下面的脚本苹果,我们可以设置特定的file.abc。

默认的应用程序

  

告诉应用程序系统事件

  文件/Users/test/Desktop/file.abc设置默认应用程序/Applications/TextEdit.app
月底告诉


但我想设置相同的默认应用程序具有文件类型或扩展为ABC的所有文件。

我曾尝试以下操作来完成它。它添加了℃的入口; HOME> /Library/$p$pferences/com.apple.LaunchServices.plist 。但这些文件不与指定的应用程序打开。

 默认写com.apple.LaunchServices LSHandlers -array-ADD \"<dict><key>LSHandlerContentTag</key><string>abc</string><key>LSHandlerContentTagClass</key><string>public.abc</string><key>LSHandlerRoleAll</key><string>com.apple.textedit</string></dict>\"

希望有人知道我为失踪去实现它。

提前致谢





答找到:

 默认写com.apple.LaunchServices LSHandlers -array-ADD \"<dict><key>LSHandlerContentTag</key><string>ugurugu</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key<string>org.videolan.vlc</string></dict>\"
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain本地-domain系统-domain用户


解决方案

也许你没有做错什么,但是该文件com.apple.launchservices只是需要重新加载。你可以注销,等待几分钟或强制launchservices重新启动。在下面的例子中,我说public.comma分隔值文本文件(注:这并不意味着每一个CSV文件是这样的内容类型)。必须用文本编辑,而不是Excel中打开

 做shell脚本默认写com.apple.LaunchServices LSHandlers -array-ADD{LSHandlerContentType = \\public.comma分隔值文本\\; LSHandlerRoleAll = \\ com.apple.TextEdit \\;}'做shell脚本\"/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain本地-domain系统-domain用户

In Mac OSX lion, I m trying to set default application for specific file types. Using the below apple script, we can set the default application for the specific "file.abc".

tell application "System Events"
set default application of file "/Users/test/Desktop/file.abc" to "/Applications/TextEdit.app"
end tell

But i want to set the same application as default for all the files having the filetype or extension as "abc".

I have tried the following to get it done. It added an entry in <HOME>/Library/Preferences/com.apple.LaunchServices.plist. But the files not opened with the specified application.

defaults write com.apple.LaunchServices LSHandlers -array-add "<dict><key>LSHandlerContentTag</key><string>abc</string><key>LSHandlerContentTagClass</key><string>public.abc</string><key>LSHandlerRoleAll</key><string>com.apple.textedit</string></dict>"

Hope somebody knows what i m missing to achieve it.
Thanks in advance



Answer Found :

defaults write com.apple.LaunchServices LSHandlers -array-add "<dict><key>LSHandlerContentTag</key><string>ugurugu</string><key>LSHandlerContentTagClass</key><string>public.filename-extension</string><key>LSHandlerRoleAll</key<string>org.videolan.vlc</string></dict>"
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user

解决方案

Maybe you're doing nothing wrong but that the com.apple.launchservices file just needs to be reloaded. You can logout, wait a few minutes or force launchservices to restart. In the following example I say that public.comma-separated-values-text files (note:This doesn't mean that every CSV file is this content-type) must be opened with TextEdit instead of Excel.

do shell script "defaults write com.apple.LaunchServices LSHandlers -array-add '{ LSHandlerContentType = \"public.comma-separated-values-text\"; LSHandlerRoleAll = \"com.apple.TextEdit\"; }'"

do shell script "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user"

这篇关于如何设置在Mac OS X中的特定文件类型的默认应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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