The OS X log-in items feature is useful for quickly opening the programs, documents, folders, and other items that you regularly use when first logging in to your system. We recently outlined some of the options you can use the log in items list for, and in response some readers have written in with some suggestions and concerns, specifically around the option to hide applications that are launched where some programs do not seem to remain hidden.
When you set up log-in items, you can check the option to hide them, which will keep them running for quick access but prevent them from taking up your desktop and cluttering your workflow. While this is convenient, it does not happen for all applications.
MacFixIt reader Marcus writes:
I like to start items on log in, however I like them hidden. You cannot hide the address book. When it is set to hide it will still show...
When some applications launch initially, some aspects of the interface will load, but at a later point the interface or its content may be updated and cause the program to claim input focus. Therefore, you may see situations where you load an application and then switch to another program, only to have the first one jump back to being the foremost program again.
This behavior can also cause a hidden application to unhide, so if you have an application such as Address Book set to hide when launched in the log-in items, they may initially launch in a hidden state but then their interfaces are updated and they will pop out of being hidden.
Unfortunately you cannot directly address this behavior quirk through the log-in items options; however, you can do this by using a launcher script. Since the log-in items will run applications, you can create an AppleScript or Automator application that will open the desired program and set it to hide, ensuring it remains so even when its interface and contents are updated during launch.
The script that will do this for an application is the following:
application "Address Book" to
tell application "Address Book" to activate
tell application "System Events"
set visible of process "Address Book" to false
This script will first activate the program that will launch it, and then ensure it is in the forefront before setting its hidden status. The current script is for Address Book, but you can substitute the "Address Book" name for the name of another program.
To implement this script in an AppleScript application, do the following:
- Open AppleScript Editor, which is available in the /Applications/Utilities/ folder.
- In the scripting window, copy and paste the above script.
- Save the script, and in the "File Format" menu choose "Application" (you can optionally choose for it to be "Run Only").
To implement this script in an Automator application, do the following:
- Launch Automator and create an Application.
- Go to the "Utilities" library and drag the "Run AppleScript" action to the workflow window.
- Replace the line "(* Your script goes here *)" with the above script.
- Save the file as an application.
Editors' note: Automator and AppleScript use the same underlying technologies, so there is no real difference between these methods. In Automator there are other workflow actions such as the "hide all applications" action that can also be useful when building this script.
When either of these two procedures are done, add the final application file to your account's log-in items via the Accounts system preferences, and when you next log in, the script will run and launch the program it references, this time properly hiding it. You can create multiple copies of the script to launch multiple applications, or you can do this by repeating the script in the same file and changing each repetition to reference a different application.