Should probably create a library for this task. Got the idea from this OS X Hint: http://hints.macworld.com/article.php?story=20130722033452283