• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Open System Preferences?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: Open System Preferences?
      • From: Ali Ozer <email@hidden>
    • Re: Open System Preferences?
      • From: d2kagw <email@hidden>
References: 
 >Open System Preferences? (From: d2kagw <email@hidden>)
 >Re: Open System Preferences? (From: Andrei Tchijov <email@hidden>)

  • Prev by Date: New windows and accepting input...
  • Next by Date: Re: Open System Preferences?
  • Previous by thread: Re: Open System Preferences?
  • Next by thread: Re: Open System Preferences?
  • Index(es):
    • Date
    • Thread