How can I configure a script to launch at startup?

There are a couple ways to do this:

  1. You can save the script as an application, and add it to the “Login Items” window in the “System Preferences” application. This can be done by either dragging and dropping the script onto the “Login Items” window, or by clicking the “Add…” button in the window.
    Programatically, you can use this code:
tell application "System Events"
	make login item at end with properties {path:"/path/to/app", hidden:false}
end tell
  1. You can save your script as an application, and move it into the “Library > StartupItems” folder on your hard drive. If the “StartupItems” folder doesn’t exist, then you can create it, making sure that no spaces exist in its name.