Objective C - Application Open?

Discussion in 'Mac Programming' started by tom3097, Dec 21, 2005.

  1. macrumors newbie

    Joined:
    Oct 12, 2005
    #1
    Is there a way for when an application launches it checks to see if certain applications are open.

    If so change the properties of certain items on a window.

    Objective C or Applescript, which ever can do it. Please note that i know only limited Applescript and hardly and Objective C.
     
  2. Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #2
    You could shell out to ps to get a list of running processes and check that?
     
  3. thread starter macrumors newbie

    Joined:
    Oct 12, 2005
    #3
    Note sure how to do that, and does objective-c allow editing of an applications window. i.e. change some text.
     
  4. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #4
    Change what text? Are you talking about in your application or in some other running application? In the first case, certainly, if you're trying to change text in some other running application, no, or not easily anyway. At least not without that application's cooperation, or through AppleScript or something. Applications are generally not supposed to go poking around in other applications changing things without their knowledge. As for getting a process list you can look up "man ps" in the Terminal and the see Apple documentation for NSPipe and TSTask.
     
  5. thread starter macrumors newbie

    Joined:
    Oct 12, 2005
    #5
    Thanks, and its changing text in my application not some other application.
     
  6. macrumors 601

    HiRez

    Joined:
    Jan 6, 2004
    Location:
    Western US
    #6
    Some Cocoa UI controls, such as NSTextField, have a method -setStringValue: where you can pass them an NSString to change their value (the text). This can also be accomplished through Cocoa bindings. If you mean the window's title, either set it directly in IB or send the window a -setTitle: message with an NSString.
     
  7. macrumors regular

    Joined:
    Apr 16, 2003
    Location:
    Minneapolis, MN

Share This Page