Searching an application from file/creator type

: I’ve a file with a "BINA " type and “dosa” creator. Does
: ayone know how to find the application that open it? Jean-baptiste LE
: STANG
This should get the name of the application. Is that what you want or do
you need the path?
tell application “Finder” to set appName to name of application file id “dosa”
Rob J

…OR, not using the Finder:

set {maker, appName} to {"", ""}
repeat until maker's length = 4
    set maker to text returned of (display dialog "Creator code:" default answer maker)
end repeat
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
try
    set appName to ((path to creator maker) as string)'s text item -1
    set AppleScript's text item delimiters to od
on error errTxt number errNum
    set AppleScript's text item delimiters to od
    if errNum = -35 then set errTxt to "No app found with creator code "" & maker & ""."
    display dialog errTxt & return & "Error N¼ " & errNum
end try

appName More code than using the Finder, but the bonus is that it should be fast.
Obviously, if you want the path just leave off the 's item -1. (And leave off the as string if you want the other format).
Andreas

You’ve probably already spotted it for yourself - if you want the path and not the name then you can delete the three lines referring to delimiters.
Andreas

Hi,
Note that Andreas script uses Akua Sweets Scripting Addition for the ‘path to creator’ command.
While I’m here, if you’re getting the file type from a file and using the file type to find the application that opens it then you can use the short cut:
set the_app to (default application of (info for file_reference))
where file_reference is a reference to the file. This may not work with applications that create applications though. As then, the latest applicatin created will probably be used and not the original.
Kel.