Re: Opening a local HTML file in the default browser
Re: Opening a local HTML file in the default browser
- Subject: Re: Opening a local HTML file in the default browser
- From: julifos <email@hidden>
- Date: Sun, 12 Jan 2003 18:56:13 +0100
>
Hi,
>
>
I'm creating an HTML file using AppleScript Studio. Once the file has been
>
created, I want to open it in the user's default browser as set in the
>
internet pane of system prefs.
>
>
Using "open file", the HTML file always seems to open in Internet Explorer
>
instead of in whatever browser is selected as the default.
>
>
Using "open location" the default browser is used for URLs that start with
>
"http:", but for those that start with "file:", again IE is always used.
>
>
Since I can't seem to make a local file open in the default browser, can
>
anyone tell me how I can determine what application the user has selected as
>
his default browser (either by creator ID or location)?
>
>
(I am using OS 10.1, in case it matters, and unfortunately, I can't upgrade to
>
10.2 at this point.)
>
>
Thanks!
>
>
Ernie
set dfb to read ((path to preferences as text) &
"com.apple.LaunchServices.plist" as alias)
set x to offset of "<key>U:http</key>" in dfb
set dfb to text from character x of dfb to character (x + 800) of dfb
set x to offset of "<key>LSBundleSignature</key>
<string>"
in dfb
set dfb to text from character (x + 41) of dfb to character (x + 44) of dfb
This should return creator signature of the default browser (MSIE, OPRA...).
Then:
tell app "Finder" to open x using app file id dfb
If this does not work (tested only here), the way you must follow is reading
"com.apple.LaunchServices.plist" (at user prefs), then search for
"<key>U:http</key>" or "<key>E:html</key>" (some guys say that this string
is not always there, unless the user has defined "please, finder, open every
html file using this app"), then for its "LSBundleSignature"...
Cheers.
JJ
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.