Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Stagger startup items for less system impact System 10.4
I don't know about you, but whenever I start/restart my Mac, I hate the way that when it's reached the Desktop, it tries to launch all the start-up items at the same time. Then the hard drive starts whirring like mad, hopping back and forth and splitting its time between each app. Some of my menu bar items that launch at start-up are standard apps, i.e. non-system stuff, so I tried altering the way they launch by delaying them for a certain amount of time to allow other stuff to start first.

Read on for my solutions, one using Automator and the other using AppleScript.

The first thing to do was to identify which of my login apps could be launched manually. Taking my menu bar as an example, I have 13 items:
  1. Quicksilver
  2. Proxi
  3. iScrobbler
  4. AirClick
  5. Synergy
  6. Salling Clicker
  7. MenuCalendarClock
  8. AppleScript menu
  9. Bluetooth
  10. AirPort
  11. System volume
  12. Fast user switch
  13. Spotlight
Numbers 8 to 13 are system items, and numbers 5 and 6 are System Preferences panes -- none of these, as far as I know, can be launched individually. Number 7 automatically adds itself to the System Preferences -> Account -> Login Items list when it's launched, so we can forget that one, too. This leaves us with numbers 1 through 4, all of which can be started manually and told not to start at login ... which is what we need to do next: this is either done within the app's preferences (usually a 'Start at login' checkbox or something similar) or by deleting its entry in the System Preferences -> Account -> Login Items list.

I figured I could use Automator to do what I wanted but, for those of your who prefer it, I also did it using AppleScript.

Automator method

This is a relatively easy workflow to create -- the Pause action can be found in the Automator Library, and the Launch Application action resides in the Finder library:
  • Pause: 20 seconds
  • Launch Application: AirClick
  • Pause: 2 seconds
  • Launch Application: iScrobbler
  • Pause: 2 seconds
  • Launch Application: Proxi
  • Pause: 2 seconds
  • Launch Application: Quicksilver
AppleScript method Fire up Script Editor (usually located in Applications -> AppleScript) and enter something like:
delay 20
tell application "AirClick"
  launch
end tell
delay 2
tell application "iScrobbler"
  launch
end tell
delay 2
tell application "Proxi"
  launch
end tell
delay 2
tell application "Quicksilver"
  launch
end tell
The delay command tells it to wait for that many seconds and the tell application "..." - launch - end tell bit launches the specified app -- pretty simple stuff.

Both methods

Change the app names to suit your setup, and experiment with the delays that work best for you. Presumably Macs that are newer and faster than my iMac G4 will be more suited to shorter delays. Select File -> Save As..., give it a suitable name and location, and make sure you change the File Format to Application.

Starting the, erm, delayed start

Finally we need to add our workflow or script to our login items: go to System Preferences -> Account -> Login Items, click the plus button, navigate to wherever you saved your workflow or script, select it, and click Add. And now you can restart your Mac to try it out.

[robg adds: We have a much older hint that has an AppleScript to work around what was then a bug in OS X's login routine; presumably a variation of that script would still work today.]
    •    
  • Currently 2.67 / 5
  You rated: 3 / 5 (6 votes cast)
 
[34,025 views]  

10.4: Stagger startup items for less system impact | 15 comments | Create New Account
Click here to return to the '10.4: Stagger startup items for less system impact' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Stagger startup items for less system impact
Authored by: wallybear on Jul 18, '06 08:05:30AM

you can make the script shorter replacing:

tell application "whatever"
launch
end tell

with

tell application "whatever" to launch

and if you can get your hands dirty with shell commands, you can use the following script without using delays:

open "/Applications/Mail.app" ; open "/Applications/Safari.app" ; open "/Applications/whatever.app"

Of course this is more complicated as you have to know the correct path for every application to start, but you can incorporate it in an AppleScript using the "do shell command" command. This method launches one app after the previous one finished launching, so no delay is necessary.



[ Reply to This | # ]
10.4: Stagger startup items for less system impact
Authored by: NB on Jul 18, '06 08:29:44AM

"open -a Mail" works quite well you know.



[ Reply to This | # ]
Summation plus correction
Authored by: MtnBiker on Jul 18, '06 09:47:16AM
I think this is a working sample

delay 40
do shell script "open -a iKey; open -a Skype; open -a Butler;"
The correction is "script" not "command." Thanks to all the posters. I've never been happy with my other solutions to this problem. I think the serial shell script solution will work for me.

---
Hermosa Beach, CA USA

[ Reply to This | # ]

Summation plus correction
Authored by: wallybear on Jul 18, '06 10:54:59AM

That's correct. My mistake.
It's "do shell script", not "do shell command".



[ Reply to This | # ]
Summation plus correction
Authored by: babbage on Jul 18, '06 12:27:33PM

For that matter, the shell code can do the delays too, with something like:

sleep 20
open /Applications/MyApp.app
sleep 2
open -a Mail
sleep 2
open /Applications/Safari.app/Contents/MacOS/Safari

Et cetera. Note that sleep in the shell code replaces the delay in the Applescript, and that the three variants of the open command can all be used more or less interchangeably. The second version is usually shortest, but the short name for an app launched this way isn't always obvious, e.g. I think the Office programs all have slightly oddball short names, but off the top of my head I can't remember what they were, or how to look that string up. Using the other two versions is a little more typing, but it's guaranteed to work.

---

--
DO NOT LEAVE IT IS NOT REAL

[ Reply to This | # ]

10.4: Stagger startup items for less system impact
Authored by: triplef on Jul 19, '06 02:02:08AM
This method launches one app after the previous one finished launching, so no delay is necessary.
This isn't the case here using Mac OS X 10.4.7. On my system, "open" returns immediately, i.e. before the opened app finishes bouncing in the Dock.

Using multiple Finder actions to open applications in Automator worked though. Using this method the apps are launched sequentially.

[ Reply to This | # ]

10.4: Stagger startup items for less system impact
Authored by: mpress25 on Jul 18, '06 08:22:15AM

My only problem with the Automater workflow is the inability to Hide apps after launching (which I especially want to do with iCal and Mail.)



[ Reply to This | # ]
10.4: Stagger startup items for less system impact
Authored by: Timmargh on Jul 18, '06 01:12:51PM

Just add an AppleScript action with something like:

tell application "System Events" to set visible of process "iCal" to false
tell application "System Events" to set visible of process "Mail" to false



[ Reply to This | # ]
10.4: Stagger startup items for less system impact
Authored by: redclawx on Jul 18, '06 10:54:43AM

Here's my startup list:
In Login Items:
1. GrowlHelperApp
2. iCal (set to hidden)
3. iTunesHelper
4. AddressBook (set to hidden)
5. Login Script
6. FoldersSynchronizor (set to hidden)
7. Synergy
8. Microsoft Database Deamon
9. iCalAlarmScheduler


The "Login Script" is an Automator application:
1. Run AppleScript:
tell application "System Events"
key code 111
end tell
2. Launch Application: HardwareGrowler.app
3. Launch Application: Mail
4. Launch Application: Safari
5. Launch Application: iChat
6. Launch Application: Microsoft Messenger
7. Launch Application: Microsoft Entourage
8. Run AppleScript:
tell application "System Events"
key code 111
end tell


I don't put pause statements between the Automator actions because it's not necessary. When an application launches the action won't complete until the application is fully launched. The AppleScripts at the beginning and end are for activating Dashboard. Dashboard will activate and the apps will launch in the background. This allows me to see what the weather to doing for the day, what local gas prices are doing, etc. After everything is done Dashboard goes away and the system is ready to be used.



[ Reply to This | # ]
10.4: Stagger startup items for less system impact
Authored by: mark hunte on Jul 18, '06 01:04:41PM
Using the shell command sleep instead of delay is
less cpu hogging if I remember right because it sleeps the whole script process.

So in applescript. do shell script "sleep 40"

---
mh

[ Reply to This | # ]

10.4: Stagger startup items for less system impact
Authored by: barefootguru on Jul 18, '06 05:18:53PM

That was fixed in OS X 10.4.3 - AppleScript 1.10.3:

'The delay command now yields more time to other processes. [4179466]'

Cheers



[ Reply to This | # ]
Preference Panes
Authored by: triplef on Jul 19, '06 02:23:40AM
[...] numbers 5 and 6 are System Preferences panes -- none of these, as far as I know, can be launched individually
You have to lauch the helper apps contained in the preference pane bundle's "Resources" folder: SEC Helper.app and Synergy.app respectively. Additionally you have to disable "lauch at login" in the preference panes, so the helper apps don't get added to the list of login items (AFAIK this works for Synergy only).

[ Reply to This | # ]
Preference Panes
Authored by: Timmargh on Jul 20, '06 07:48:44AM

That's useful to know - cheers!



[ Reply to This | # ]
10.4: Stagger startup items for less system impact
Authored by: omo on Jul 19, '06 03:21:49PM
Hi everybody

I use this script doing almost the same by looping through an array, so it might be much easier to add and remove apps if you need to - just edit the list (appsToStart) at the start. Moreover it hides the apps after launching them so you don't end up with a cluttered desktop. (It even hides them more the the prefernce pane - on my system ;) Have fun.

property appsToStart : {"iChat", "Skype", "BluePhoneElite", "Synergy", "ClamXavSentry", "iScrobbler", "Mail"}

repeat with appToStart in appsToStart
	
	with timeout of 120 seconds
		tell application appToStart to launch
	end timeout
	
	delay 2
	
	tell application "System Events"
		try
			set visible of process appToStart to false
		end try
	end tell
	
end repeat


[ Reply to This | # ]
10.4: Stagger startup items for less system impact
Authored by: talonwood on Jul 25, '06 06:53:40PM

I've been using the older AppleScript that Rob linked to in the hint for at least a couple years with no problems.

It makes use of a directory with aliases to the applications you want to launch, and you can rename the aliases to make the apps launch in a certain order.

Scroll down through the comments to that hint for the slightly newer script.



[ Reply to This | # ]