I can find the default application associated with a certain file with this script.
tell application "Finder"
default application of (info for POSIX file "/Users/vk/Pictures/DSCF3320.jpg")
end tell
But is there any way to list ALL applications associated with this file? I.e. the same list which is displayed in Finder when you click "Open with"?
The code is in AppleScript but I do not necessarily require the solution to be in AppleScript.
Actually I found that this simple python script does exactly what I need:
import sys
from AppKit import NSURL
from LaunchServices import LSCopyApplicationURLsForURL, kLSRolesAll
url = NSURL.fileURLWithPath_(sys.argv[1])
for url in LSCopyApplicationURLsForURL(url, kLSRolesAll):
print url.path()