title: Add app to OSX "Login Items" during a Package Maker installer postflight script
body: <p>I need a way to add an application to the Login Items from a postflight script which is run as part of my installer.  It needs to work on 10.5+.  Preferably, it would work in a bash script.  My application already requires administrative rights.</p>
  
  <p>The approach I found here: <a href="https://stackoverflow.com/questions/4912212/mac-os-login-items-with-arguments">Mac OS Login Items with Arguments?</a> seemed to be on the right track (included below)... but didn't work when I tried it on command line and I'm not sure how to make it install for All Users or if I need to add logic to check if it's already added to startup items before calling this code.</p>
  
  <pre><code>#!/bin/bash
  /usr/bin/osascript -e "tell application \"System Events\" to make new login item with properties { path: \"$1\", hidden:false } at end"
  </code></pre>
  
  <p>I suspect I could also do something with a launchd.  But, I'm not sure which approach is the best practice for compatibility across versions.</p>
  
  <p><strong>NOTE: I do NOT want to add it using some objective-c code inside my app.  I need the installer to add it.</strong>  Currently, what I do is start the application after install which then Adds it to Login Items in code using the LSSharedFileListRef... Example of that approach can be found here: <a href="https://stackoverflow.com/questions/815063/how-do-you-make-your-app-open-at-login">How do you make your App open at login?</a>.  The reason this is not ok is I need to make my application install with Apple Remote Desktop via command line, when on the login screen.  So, the application needs to not start automatically after install.</p>