title: How to add login Items by code to mountain lion osx
body: <p>I want to add login items programmatically in Mountain Lion (10.8).</p>
  
  <p>Until now I was able to add login items by editing this plist:</p>
  
  <pre><code>/Users/test/Library/Preferences/loginwindow.plist
  </code></pre>
  
  <p>and adding items (path,name,hide) to <code>AutoLaunchedApplicationDictionary</code> dictionary
  in the OS doesn't work anymore. Items that are added to this dictionary are not launched on login. I see that the login items are saved in a file called: <code>com.apple.loginitems.plist</code></p>
  
  <p>but I don't understand how to add an item to this file. I tried to add the item to <code>CustomListItems</code> dictionary with parameters like name,path, hide but they were not launched on login.</p>
  
  <p>Does anyone know how can I add from code login item?</p>