Created
October 4, 2008 19:56
-
-
Save Grayson/14798 to your computer and use it in GitHub Desktop.
Get default application for url schemes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# usage: python getDefaultAppForURL.py 'http://' 'ftp://' 'afp://'... | |
from LaunchServices import LSGetApplicationForURL, kLSRolesViewer | |
from Foundation import NSURL | |
from sys import argv | |
for arg in argv[1:]: | |
url = NSURL.URLWithString_(arg) | |
if url == None: continue | |
result = LSGetApplicationForURL(url, kLSRolesViewer, None, None) | |
print result[-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment