How to hide stubborn log-in items in OS X

While log-in items in OS X can be hidden, some may not do so and end up displaying onscreen when you log in to your system. Here is an approach to address this problem.

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:

tell application "Address Book" to activate
tell application "Address Book" to activate
tell application "System Events"
set visible of process "Address Book" to false
end tell

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:

  1. Open AppleScript Editor, which is available in the /Applications/Utilities/ folder.
  2. In the scripting window, copy and paste the above script.
  3. 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:

  1. Launch Automator and create an Application.
  2. Go to the "Utilities" library and drag the "Run AppleScript" action to the workflow window.
  3. Replace the line "(* Your script goes here *)" with the above script.
  4. 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.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.

Tags:
Computers
About the author

    Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.

     

    Join the discussion

    Conversation powered by Livefyre

    Show Comments Hide Comments