DefaultApplication
version 0.1
Requires Mac OS X 10.1 or higher
HAMSoft Engineering allows free use of this code and/or software in its "as is" condition. HAMSoft Engineering disclaims any liability of any kind for any damages whatsoever resulting from the use of this code and/or software. If you find it useful please consider making a donation to help HAMSoft Engineering stay in business.
download the compiled command line tool
download the source code project
Use this command line tool to get the default application from Launch Services for either a file path, a file extension, or a URL.
Usage: DefaultApplication
[-path "path/to/file"] get the default application from a file path
[-ext "fileExtension"] get the default application from a file extension
[-url "someURL"] get the default application from a URL
Example usage of the tool with applescript: set daPath to (path to home folder as text) & "UnixBins:DefaultApplication" set theFile to choose file do shell script quoted form of POSIX path of daPath & " -path " & quoted form of POSIX path of theFile
Open this Script in your Editor
Open this Script in your Editor set daPath to (path to home folder as text) & "UnixBins:DefaultApplication" set theExtension to "pdf" do shell script quoted form of POSIX path of daPath & " -ext " & quoted form of theExtension
Open this Script in your Editor set daPath to (path to home folder as text) & "UnixBins:DefaultApplication" set theURL to "mailto:" do shell script quoted form of POSIX path of daPath & " -url " & quoted form of theURL
