[Pythonmac-SIG] How to tell if a .app is clicked again?
Bob Ippolito
bob at redivi.com
Wed Aug 17 03:01:38 CEST 2005
On Aug 16, 2005, at 1:10 PM, Chris Barker wrote:
> Nicholas Riley wrote:
>
>>> Which leads me to another idea: Can I tell OS-X that I DO want
>>> another
>>> instance of the app launched rather than raising an existing one?
>>>
>
>
>> You can do this (LaunchServices lets you multi-launch apps, or you
>> can
>> always execute the binary directly), but not from the Finder.
>>
>
> Darn.
>
>
>> However, you could do something slightly different, and closer to
>> your
>> first idea: embed the actual app inside the launcher app's
>> bundle. Then start your real app, with an icon or not, when the
>> launcher app runs; the launcher app would then exit. If the launcher
>> app notes that the real app is already running, then just open the
>> page in the browser.
>>
>> The user would only see one app, and since the Finder in OS X no
>> longer shows apps differently when they're open, they'd never know
>> the
>> difference.
>>
>
> I like this. Now I have to figure out how to put another app inside a
> Py2app'd bundle. The "main" app and the one inside would both be
> python
> apps.
>
> It looks to me like a Py2app bundle has a little stub as the
> executable.
> Could I build two py2app bundles, of two different scripts, then just
> drag the executable from one into the other to get two in one, that
> would share all the resources?
>
> I guess I'll go try.
Nope that doesn't work.. What you should do is simply re-execute the
same application with different command line arguments.
LaunchServices won't pick up on the second launch because it was done
outside of LaunchServices.
-bob
More information about the Pythonmac-SIG
mailing list