Re: Open System Preferences?
Re: Open System Preferences?
- Subject: Re: Open System Preferences?
- From: Uli Kusterer <email@hidden>
- Date: Sun, 16 Apr 2006 11:59:43 +0200
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