On Mac OSX lion, I am trying to set the default application for certain file types. Using the apple script below, 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 install the same default application for all files that have a file type or extension like "abc".
I tried the following to do this. He added an entry to <HOME>/Library/Preferences/com.apple.LaunchServices.plist
. But the files do not open 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 someone knows what I am missing to achieve this.
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
source share