Launch login items via AppleScript to avoid login delays

Nov 18, '09 07:30:02AM

Contributed by: nathanator11

I found that most of my startup items were things that I didn't need right away (Google Quick Search Box, LaunchBar, etc.). A simple AppleScript can be used to avoid the pileup of programs all trying to open at once at login. The result: a much faster login time.

The script works by opening programs one by one, with a little time in between. This gives the programs time to load, and allows you to use your computer as soon as you enter your password. The code looks like this:

tell application "Google Notifier" to activate
delay 3
tell application "LaunchBar" to activate
delay 3
set volume 4
tell application "BOINCManager" to activate
tell application "Quick Search Box" to activate
tell application "RealPlayer Downloader Agent" to activate
So, immediately opened is Google Notifier. Shortly thereafter comes LaunchBar. Afterwards, the volume is set to half loudness, and some other programs open.

To make this work for you, all you have to do is paste the above code into AppleScript Editor (in Applications » Utilities in 10.6) or Script Editor (in Applications » AppleScript in previous releases), replace the names of applications (tell application...) with yours, and change the delay times to suit your needs (the number represents seconds).

Finder windows can be triggerd by inserting the following code:

tell application "Finder" to open "Path:To:Folder"
Once you've completed the script, save it as an application. Set it as your one and only startup item. This will load at login, and launch the applications one by one.

The result is a computer that is ready to use immediately after login. It has also given me the freedom to use programs that I avoided before, because they caused a longer login time. The only disadvantage I've encountered: the AppleScript commands that are said to hide applications aren't working. As a result, programs pop up a window when they launch. For me, that's been a tiny price to pay for the speed.

[robg adds: This is a simpler version of a much older hint that worked around a then-bug in the OS. Because that original hint is ancient, and was referred to relative to the bug, I thought it worth publishing this new hint, and referring back to the original. The original hint also contains a way to force the launched programs to hide, via an entry in the Comments section of the Get Info window. If you're troubled by long login times while your startup items load, try one of these script-based workarounds.]

Comments (31)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20091108173250445