Re: Open System Preferences?
Re: Open System Preferences?
- Subject: Re: Open System Preferences?
- From: d2kagw <email@hidden>
- Date: Sun, 16 Apr 2006 20:05:48 +1000
Well it seems as though theres quite a few ways of getting the same
thing done...
And I would consider, given the type of app im writing, along with
the fact that its not doing anything scary at all, just launching an
application, that it would come down to personal preference?
Im pretty keen on using NSTask cause it seems [ besides Andrei's
example, cause thats using stuff i've never seen before ] to be the
fastest solution both to run and to maintain...
do you think I would be wrong in saying that?
- Az
On 16/04/2006, at 7:59 PM, Uli Kusterer wrote:
Am 16.04.2006 um 05:21 schrieb Andrei Tchijov:
[
[ NSTask
launchedTaskWithLaunchPath: @"/usr/bin/open"
arguments: [ NSArray arrayWithObject: [ @"<PATH TO THE
PREFERENCE PANE YOU WANT TO OPEN>" stringByExpandingTildeInPath ]]
]
waitUntilExit
];
Is there anything wrong with using Launch Services directly?
(untested code):
#import <LaunchServices/LaunchServices.h>
BOOL UKLaunchSpeechSettings( NSURL* *outLaunchedAppURL )
{
NSURL* myPrefPane = [NSURL fileURLWithPath: @"/System/Library/
PreferencePanes/Speech.prefPane"];
NSURL* launchedAppURL = nil;
OSStatus err = LSOpenCFURLRef( (CFURLRef) myPrefPane, (CFURLRef
*) outLaunchedAppURL );
[(*outLaunchedAppURL) autorelease];
if( err == noErr )
return YES; // success.
else
return NO;
}
I don't see why everyone always keeps starting up command-line
tools or even inserting placeholders in shell scripts when we have
perfectly good APIs (and this time it's not even "evil Carbon").
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden