PDA

View Full Version : Add login items script




andrewheard
Apr 18, 2006, 07:16 PM
Is it possible to add an application to the login items of a user account using a script? I was going to have an installer for my little program and I think that it would make it easier for users if they didn't have to add it themselves. This (http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/CustomLogin.html#//apple_ref/doc/uid/20002134) works but it would then be difficult for the user to uninstall the application.

Thanks in advance,

Andrew



kainjow
Apr 18, 2006, 08:08 PM
set appPath to "/Applications/MyProgram.app"
tell application "System Events"
make login item at end with properties {path:appPath, hidden:false}
end tell

SC68Cal
Apr 18, 2006, 10:11 PM
As an alternative, save the script as an application and add it to your login items in the system preferences. That way, the program does not inheriently start up at login, I'm not a big fan of that myself.