baFindApp returns the application associated with a file type.


Windows and Macintosh


Result = baFindApp( Extension )


Extension is the extension of the file type.


Returns the full path name to the application. Returns an empty string if the extension is not associated with or a program, or the associated program does not exist.


Notepad = baFindApp( ".txt" )

Notepad := baFindApp( ".txt" )


On Windows, Microsoft guidelines state that if a program registers a file extension, and the path to the executable file is a long file name, then that name must be included in quotes. If an installation program doesn't follow these guidelines, then this function may fail. Specifically, if the path name to the executable contains a space, then this function will not be able to return the path to the executable. Adobe Acrobat Reader 3 is one program that does not register itself correctly - it does not place quotes around the executable name in the registry. The baFindApp function has been written around this particular problem with Acrobat, and will use other methods to locate Acrobat if it is asked to find the application associated with "pdf" files. You do not have to include the . with the extension.

On Macintosh, each application has it’s own unique four character identifier eg, “CARO” for Acrobat, “MOSS” for Netscape, “MSIE” for Internet Explorer. There are a number of shareware utilities available which will tell you the creator type of a application, such as File Buddy by Laurence Harris, or you can use baFileCreator.
You can also use extensions to find an application. For example, baFindApp( ".txt" ) will return the application that will open .txt files that don't have a file type/creator. You must use a . at the beginning of the extension.
If the application found is inside a bundle, then the name that is returned is the name to the bundle. You can tell if a bundle has been returned because it will end in a folder separator.
For example, baFindApp( ".txt" ) may return "" You can pass this name into other Buddy functions, eg baOpenFile.

See also: