Re: To make an application start everytime when another program starts
Re: To make an application start everytime when another program starts
- Subject: Re: To make an application start everytime when another program starts
- From: John Pannell <email@hidden>
- Date: Thu, 23 Sep 2010 16:02:59 -0600
Hi there-
Read up on launchd, Apple's system init solution:
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man8/launchd.8.html
http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man5/launchd.plist.5.html#//apple_ref/doc/man/5/launchd.plist
Excellent architectural background here:
http://developer.apple.com/library/mac/#technotes/tn2005/tn2083.html
Based on my reading of what you are trying to do, I would guess you are looking to write a launchd "Agent" application that loads when the user logs in, watches for the launch of Word, and then does your stuff (at least part of your solution will have to be an Agent (vs. being a "Daemon") if you want to present some UI). In terms of launching-on-demand: read thoroughly the launchd.plist(5) man page... some of the options for KeepAlive, or perhaps WatchPaths might be promising if Word can reliably be seen to modify the filesystem in a specific location at launch. Otherwise, an "always-on" agent with a run loop waiting for notification for one app is not going to use a lot of cycles :-)
UI concern: if your agent is LSUIElement (prevents icon in the dock, app in force quit list, other things), I'm thinking the panel (which belongs to your app, and not word) might act funny. You might need to watch for word gaining and losing focus and hide/show your panel appropriately.
Hope this helps!
John
John Pannell
Positive Spin Media
http://www.positivespinmedia.com
On Sep 23, 2010, at 3:42 PM, eveningnick eveningnick wrote:
> Hello!
> I have written an application, that interacts with another
> "stranger"-program by Applescript. The problem is that i need my
> application to look like a plugin for "stranger program"- to display a
> panel, and to be launched automatically when the Master-program starts
> (and to finish, when the master program is terminated - this is solved
> already using NSWorkspace's events [cocoa framework]).
> I have submitted this to installer mailing list, but haven't got any
> response, so decided to try my luck here :)
> How could I make my application be automatically launched, when the
> MasterApp process is started? Does MacOS provide any means for such
> activity?
> I was thinking about installing a daemon, that would watch application
> start events (not sure how to do that, but i read somewhere that
> Linux/BSD kernels support such a feature - when a process registers
> its callback functions on processStart event). - And, if it's the only
> way, could you point me where to read about these capabilities of the
> kernel?
> But a daemon, that is launched with the system start, and which
> remains in memory all the time is not a good idea for a good
> application (though, if there's no better way, i'd try to implement
> it).
> What could be the best way to perform this autolaunch? I would be very
> thankful for any advice :)
>
> PS: Why do i need it. I am writing a "plugin" for mac:Word, that
> simplifies writing of big texts, but unfortunately Microsoft didn't
> publish mac:Office Plugin SDK. Luckily for me, Word supports external
> Applescipt commands. Everything is done by me, except this autolaunch,
> which is a real problem. I had an idea to replace MicrosoftWord binary
> in a bundle with mine (and rename original executable binary into
> something like MicrosoftWord111), so when a user doubleclicks on
> Word's, first my plugin starts, which launches Word. But i think it
> can cause problems with license agreement, and major problems with
> Autoupdates.
>
> Thank you, George
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden