Multiple instances of an app open?

  • Is it possible to open multiple instances of a Cocoa app?

    I know you are going to have something to say about this. The app is
    a windows app, that I've ported. They've done it in such a way that
    if they wanted to make it multiple document, it would have to be
    rebuilt from the ground up. Tons of global variables for just about
    everything. Even stuff that should be passed on the stack is made
    global, for no reason I can see.

    So there is no way this app can be made multiple document based.

    Is there any way multiple instances of the app can be opened then? I
    know this is wrong and bad, but I'd just like to know. I'd like to do
    it in a graceful way for the user, not ask them to duplicate the app
    in the Finder :)

    --
    http://elfdata.com/plugin/

    What does our work achieve, if it's not making the world a happier
    place?
    http://www.whatnextjournal.co.uk/Pages/Next/Happiness.html
    When's the last time you thought deeply about how to improve our lives?
  • I've noticed that if you launch an application from the command line,
    it will not "merge up" with an already running instance.  Try it for
    yourself and you will get as many instances as you desire.

    Based on that fact, if I was trying to commit the UI crime you are
    trying to commit :) , I would probably look into making a wrapper app
    bundle that, upon being launched, manually invoked the executable of
    the real application held inside of it, and immediately quit.  This
    should be enough to cause the Finder to repeatedly allow launches of
    the app, though you might have some trouble if the user tried to fire
    off two as fast as they can click...

    Daniel

    On Aug 24, 2005, at 3:15 PM, Theodore H. Smith wrote:

    > Is it possible to open multiple instances of a Cocoa app?
    >
    > I know you are going to have something to say about this. The app
    > is a windows app, that I've ported. They've done it in such a way
    > that if they wanted to make it multiple document, it would have to
    > be rebuilt from the ground up. Tons of global variables for just
    > about everything. Even stuff that should be passed on the stack is
    > made global, for no reason I can see.
    >
    > So there is no way this app can be made multiple document based.
    >
    > Is there any way multiple instances of the app can be opened then?
    > I know this is wrong and bad, but I'd just like to know. I'd like
    > to do it in a graceful way for the user, not ask them to duplicate
    > the app in the Finder :)
    >
    > --
    > http://elfdata.com/plugin/
    >
    > What does our work achieve, if it's not making the world a happier
    > place?
    > http://www.whatnextjournal.co.uk/Pages/Next/Happiness.html
    > When's the last time you thought deeply about how to improve our
    > lives?
    >
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/<jalkut...>-
    > sweater.com
    >
    > This email sent to <jalkut...>
    >
  • On 24/08/05, Daniel Jalkut <jalkut...> wrote:
    > Based on that fact, if I was trying to commit the UI crime you are
    > trying to commit :) , I would probably look into making a wrapper app
    > bundle that, upon being launched, manually invoked the executable of
    > the real application held inside of it, and immediately quit.  This
    > should be enough to cause the Finder to repeatedly allow launches of
    > the app, though you might have some trouble if the user tried to fire
    > off two as fast as they can click...

    LaunchServices has a kLSLaunchNewInstance flag you can pass in.

    -- Finlay
  • On Aug 24, 2005, at 3:34 PM, Finlay Dobbie wrote:

    > LaunchServices has a kLSLaunchNewInstance flag you can pass in.

    In that case, I'm sure glad I never had to try to do this, or else I
    would have spent a lot of time barking up the wrong tree :)
  • Pre-OS X, I heard of an app developer faced with a problem much like yours. Their solution was to embed basically the whole app into a DLL and then they could use CFM to instantiate as many as they needed, and it was fairly clean and all inside one process.

    I think this sort of solution might still be applicable on OS X.

    -----Original Message-----
    From: cocoa-dev-bounces+jstiles=<blizzard.com...> on behalf of Theodore H. Smith
    Sent: Wed 8/24/2005 12:15 PM
    To: Cocoa List
    Subject: Multiple instances of an app open?

    Is it possible to open multiple instances of a Cocoa app?

    I know you are going to have something to say about this. The app is
    a windows app, that I've ported. They've done it in such a way that
    if they wanted to make it multiple document, it would have to be
    rebuilt from the ground up. Tons of global variables for just about
    everything. Even stuff that should be passed on the stack is made
    global, for no reason I can see.

    So there is no way this app can be made multiple document based.

    Is there any way multiple instances of the app can be opened then? I
    know this is wrong and bad, but I'd just like to know. I'd like to do
    it in a graceful way for the user, not ask them to duplicate the app
    in the Finder :)

    --
    http://elfdata.com/plugin/

    What does our work achieve, if it's not making the world a happier
    place?
    http://www.whatnextjournal.co.uk/Pages/Next/Happiness.html
    When's the last time you thought deeply about how to improve our lives?

    _______________________________________________
    Do not post admin requests to the list. They will be ignored.
    Cocoa-dev mailing list      (<Cocoa-dev...>)
    Help/Unsubscribe/Update your Subscription:
    http://lists.apple.com/mailman/options/cocoa-dev/<jstiles...>

    This email sent to <jstiles...>
  • Why don't you use an MDI interface with your application that allows
    multiple document windows. This will allow easier process management
    and allow the user to be able to control document windows.

    On Aug 24, 2005, at 2:15 PM, Theodore H. Smith wrote:

    > Is it possible to open multiple instances of a Cocoa app?
    >
    > I know you are going to have something to say about this. The app
    > is a windows app, that I've ported. They've done it in such a way
    > that if they wanted to make it multiple document, it would have to
    > be rebuilt from the ground up. Tons of global variables for just
    > about everything. Even stuff that should be passed on the stack is
    > made global, for no reason I can see.
    >
    > So there is no way this app can be made multiple document based.
    >
    > Is there any way multiple instances of the app can be opened then?
    > I know this is wrong and bad, but I'd just like to know. I'd like
    > to do it in a graceful way for the user, not ask them to duplicate
    > the app in the Finder :)
    >
    > --
    > http://elfdata.com/plugin/
    >
    > What does our work achieve, if it's not making the world a happier
    > place?
    > http://www.whatnextjournal.co.uk/Pages/Next/Happiness.html
    > When's the last time you thought deeply about how to improve our
    > lives?
    >
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/rlangschultz%
    > 40cox.net
    >
    > This email sent to <rlangschultz...>
    >
  • That's it, you're banned from the list!
    :P :P

    On Aug 24, 2005, at 5:35 PM, Rick Langschultz wrote:

    > Why don't you use an MDI interface with your application that
    > allows multiple document windows. This will allow easier process
    > management and allow the user to be able to control document windows.
    >
    > On Aug 24, 2005, at 2:15 PM, Theodore H. Smith wrote:
    >
    >
    >> Is it possible to open multiple instances of a Cocoa app?
    >>
    >> I know you are going to have something to say about this. The app
    >> is a windows app, that I've ported. They've done it in such a way
    >> that if they wanted to make it multiple document, it would have to
    >> be rebuilt from the ground up. Tons of global variables for just
    >> about everything. Even stuff that should be passed on the stack is
    >> made global, for no reason I can see.
    >>
    >> So there is no way this app can be made multiple document based.
    >>
    >> Is there any way multiple instances of the app can be opened then?
    >> I know this is wrong and bad, but I'd just like to know. I'd like
    >> to do it in a graceful way for the user, not ask them to duplicate
    >> the app in the Finder :)
    >>
    >> --
    >> http://elfdata.com/plugin/
    >>
    >> What does our work achieve, if it's not making the world a happier
    >> place?
    >> http://www.whatnextjournal.co.uk/Pages/Next/Happiness.html
    >> When's the last time you thought deeply about how to improve our
    >> lives?
    >>
    >>
    >> _______________________________________________
    >> Do not post admin requests to the list. They will be ignored.
    >> Cocoa-dev mailing list      (<Cocoa-dev...>)
    >> Help/Unsubscribe/Update your Subscription:
    >> http://lists.apple.com/mailman/options/cocoa-dev/rlangschultz%
    >> 40cox.net
    >>
    >> This email sent to <rlangschultz...>
    >>
    >>
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/jstiles%
    > 40blizzard.com
    >
    > This email sent to <jstiles...>
    >
  • > LaunchServices has a kLSLaunchNewInstance flag you can pass in.

    Reflected in NSWorkspace since 10.3: NSWorkspaceLaunchNewInstance
    Ali
  • Nice. I made a user space application for this:
    http://scrap.dasgenie.com/articles/2005/08/26/start-it-again-mac

    have fun and shoot yourself in the foot. ;-) But seriously, for some
    single document apps this is great ;-)

    dom

    On 25.08.2005, at 03:38, Ali Ozer wrote:

    >> LaunchServices has a kLSLaunchNewInstance flag you can pass in.
    >>
    >>
    >
    > Reflected in NSWorkspace since 10.3: NSWorkspaceLaunchNewInstance
    > Ali
    >
    >
    > _______________________________________________
    > Do not post admin requests to the list. They will be ignored.
    > Cocoa-dev mailing list      (<Cocoa-dev...>)
    > Help/Unsubscribe/Update your Subscription:
    > http://lists.apple.com/mailman/options/cocoa-dev/dom%
    > 40codingmonkeys.de
    >
    > This email sent to <dom...>
    >
    >

    --
    Dominik Wagner          Mail: <dom...>
    TheCodingMonkeys        http://www.codingmonkeys.de/
    Blog - DasGenie: !Scrap http://scrap.dasgenie.com/