Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6636065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:08:15+00:00 2026-05-25T23:08:15+00:00

I am opening the system preferences application from within my application. I also would

  • 0

I am opening the system preferences application from within my application. I also would like to set the the applications frame so it is aligned at the left side of my application. The problem is that I do not know how to access the applications frame property, or launch it at a specific point.

I am using NSWorkspace to launch it, then get an instance of NSRunningApplication which I hope can be used to manipulate the window.

-(void)openPreferencesAndSetFrame;
{
    @try {
        BOOL success = [[NSWorkspace sharedWorkspace] openFile:@"/System/Library/PreferencePanes/Localization.prefPane"];
        if (success == YES)
        {
            NSArray *appArray = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.systempreferences"];
            if ([appArray count] > 0)
            {
                NSRunningApplication *sysPrefApp = [appArray objectAtIndex:0];
                //set frame here
            }
        }         
    } @catch (NSException *exception) {
        NSLog(@"%@", [exception description]);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:08:15+00:00Added an answer on May 25, 2026 at 11:08 pm

    After some research, try and error I found the solution. As mentioned AppleScript is able to do the job.

    -(void)openPreferencesAndSetFrame;
    {
        @try {
            NSAppleEventDescriptor *theResult;
            NSDictionary *errorInfo;
            float posX = 100;
            float posY = 200;
    
            NSString *sourceStr = [NSString stringWithFormat:@"ignoring application responses\r\n tell application \"System Preferences\"\r\n activate\r\n end tell\r\n tell application \"System Events\"\r\n tell process \"System Preferences\"\r\n set position of window 1 to {%f, %f}\r\n end tell\r\n end tell\r\n end ignoring\r\n", posX, posY];
            NSAppleScript *theScript = [[NSAppleScript alloc] initWithSource:sourceStr];
    
            theResult = [theScript executeAndReturnError:&errorInfo];
            if (nil == theResult ) {        
                NSString *err = [NSString stringWithFormat:
                             @"Error %@ occured call: %@",
                             [errorInfo objectForKey:NSAppleScriptErrorNumber],
                             [errorInfo objectForKey:NSAppleScriptErrorBriefMessage]];
    
                NSRunAlertPanel(@"AttachAScript Error", err, @"ok", nil, nil);
            }                
        } @catch (NSException *exception) {
            NSLog(@"%@", [exception description]);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am opening Word from within a Console Application. How can I ensure the
Opening an application( probably an .exe file) as an administrator in headless mode from
in my system when i am opening the database i get this error like
I'm loading a file: System.Drawing.Image img = System.Drawing.Image.FromFile(FilePath); Now I would like to save
Im opening a map like this: NSString *urlString = [NSString stringWithFormat:@http://maps.google.com/maps?q=%@,%@, destLat, destLong]; [[UIApplication
Rright now I'm opening excel using System.Diagnostics.Process.Start(fileInfo); to open my package after saving it
I have a CustomInstaller class (System.Configuration.Install.Installer) and basically I'm opening a dialog form at
The system that I am working on is an Intranet System only accessible within
I have a document management system, which has similar left panel as we have
I am opening a file in a frame and I wish to highlight few

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.