Tutorial :Java invoke com.apple.loginitems



Question:

I'm trying to add my Java Application to the "Login Items" preferences pane that appears in OSX. This pane is visible if you go to System Preferences --> Accounts, and click on your account name. You should then see a "Login Items" of programs that will automatically open when you log in.

I know I can add my program using launchd, or LaunchServices, but I had a few users ask if it could display inside the "Login Items" window. In order to do this, I believe I need to modify com.apple.loginitems.plist, but the file is written in binary so it can't be readily accessed. I've looked at it using

defaults read com.apple.loginitems  

and I've tried writing to it using

defaults write com.apple.loginitems key value  

but it looks like the loginitems plist is quite complex and has a weird structure. I'm wondering if there's any proper way to do this using Java. I believe there used to be a Cocoa Java extension that let you do this, but I don't think that's possible anymore in Snow Leopard.

Hopefully someone can give me a hand here :-)


Solution:1

I actually just ended up writing a (very) short Cocoa console application in XCode using http://github.com/carpeaqua/Shared-File-List-Example/blob/master/Controller.m as an example


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »