OS X - How to have starting applications (optionally) not take the focus? Is there any way to have starting application not take the focus?  Is there a setting so new windows do not pop over what we are currently working on?  (Perhaps an option to have them pop under, or start minimized?)

Background: I use command line scripts (Terminal) to load my work environment each day, and can't use my computer while the script is running. (No biggy, I can just go do other things for a few minutes).  VirtualBox is mainly the application where I notice this.
open -jga TextEdit opens TextEdit hidden (-j) and without making it frontmost (-g). The -j option was added in 10.8 and it is only shown in the help message and not in the man page. If TextEdit is already running, open -ja TextEdit (without -g) would just make TextEdit frontmost and not hidden. For some applications like TextEdit and Mail, open -jg opens a new visible window if the application is running but has no open windows, but you can use something like pgrep -x TextEdit||open -jga TextEdit as a workaround.

A second option in 10.9 and later is lsappinfo launch launchandhide=true nofront=true /Applications/TextEdit.app.

A third option is osascript -e 'launch app "TextEdit"'. Unlike the open and lsappinfo commands, it is blocked until the application finishes opening. For some applications like TextEdit and Mail, the launch command opens a new visible window if the application is not already running.

Edit: none of the options above seem to work with VirtualBox, but you can hide VirtualBox after opening it:

open -jga VirtualBox;lsappinfo setinfo -app VirtualBox kLSApplicationIsHiddenKey=true

osascript -e 'launch app "VirtualBox"' -e 'delay 1' -e 'tell app "System Events" to set visible of process "VirtualBox" to false'