Re: Get default Browser and Mail Client
Re: Get default Browser and Mail Client
- Subject: Re: Get default Browser and Mail Client
- From: Stephane ODUL <email@hidden>
- Date: Mon, 16 Sep 2002 20:02:48 -0700
It works, almost:
NSURL *aUrl;
OSStatus err;
err = LSGetApplicationForInfo(
kLSUnknownType,
kLSUnknownCreator,
CFSTR("html"), // html // webloc // mailloc
kLSRolesViewer,
(FSRef *) nil,
(CFURLRef *) &aUrl
);
if(! err)
{
NSLog(@"url: %@", aUrl);
[[NSWorkspace sharedWorkspace] openURL: aUrl];
[aUrl release];
}
It works for "html" but not for "webloc" or "mailloc". So I do not know
yet how to get the mail client. Any other suggestion ?
By the way is there a cleaner way than regex to extract the name of
the app from the URL I get: I receive
/Applications/Internet/Navigator.app and I want "Navigator".
And thank you I'm half way to solve my problem now :-).
Stephane ODUL
http://soft.odul.com/
On Monday, Sep 16, 2002, at 01:39 US/Pacific, Nathan Day wrote:
Look at Launch Services, specifically LSGetApplicationForInfo( ). This
is used to find out which app will open a file of a specific type,
extension etc. But you could give it the extension of 'mailloc' for a
Mail Internet Location and 'webloc' for a Web Internet Location. If
you have an aversion to carbon I have a wrapper class for Launch
Service on my web site, (see below) though using launch services is
pretty straight forward it uses NSURLRef which can be cast straight to
NSURL *.
On Monday, September 16, 2002, at 03:45 PM, Stephane ODUL wrote:
Hi,
I'm writing a driver for a multimedia keyboard and I'm trying to
figure out what is the default web browser.
The openURL solution do not work for me as it open a new window (even
worse with mail as it creates a new mail). I need to know what is the
current default browser so I can send it the appropriate AppleScript
(for reload, back, forward ...) and switch to the good application.
So my question is very simple: how do I get the name of the default
web browser (and mail client).
Thank you.
Stephane ODUL
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
Nathan Day
http://homepage.mac.com/nathan_day/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.