Re: Finding default browser with AS
Re: Finding default browser with AS
- Subject: Re: Finding default browser with AS
- From: JollyRoger <email@hidden>
- Date: Mon, 30 Apr 2001 06:34:33 -0500
on 4/30/2001 5:55 AM, Jan Pieter Kunst at email@hidden wrote:
>
Andy Wylie (email@hidden) schreef op 30-04-2001 12:35 :
>
>
>> Another beginner's question. Is it somehow possible to find the user's
>
>> default web browser (as identified in the Internet control panel) with
>
>> Applescript?
>
>>
>
>> I know 'open location <URL>' uses the default browser to open the supplied
>
>> URL, but I would like to find the default browser without opening an URL.
>
>
>
> you could ask File Exchange for the browser sig Jan:
>
> _____________________________
>
>
>
> tell application "File Exchange"
>
> run
>
> set browser to creator type of (extension mapping "html")
>
> quit
>
> end tell
>
> browser
>
> _____________________________ Andy
>
>
>
That works, thanks! I was hoping to be able to do this without launching a
>
separate application (because that is relatively time-consuming), but if
>
this is the only way it will have to do.
Note that the setting in File Exchange is not necessarily the same as the
setting in the Internet Control panel (aka Internet Config settings). If
you want that, there is a scripting addition called something like
"ICSettings" that might allow you to get the real setting.
>
But (wild idea) maybe I could do this only once, and save the browser
>
signature in some kind of 'preference' for the script? By saving a text file
>
with the signature somewhere, maybe, or is it somehow possible for a script
>
to modify itself permanently? I.e., something like, on first run, find
>
browser signature, save self with information about default browser, use
>
that browser for subsequent runs?
Just save it in a property:
property gBrowserCreator : ""
on run
if gBrowserCreator = "" then my ResolveBrowser()
end run
on ResolveBrowser()
tell application "File Exchange"
set browser to creator type of (extension mapping "html")
quit
end tell
return browser
end ResolveBrowser
HTH
JR