Using the OS X Script Editor can help automate a lot of tedious tasks. In this repository there are some JXA scripts to simplify some tasks. By pasting these javascript snippets in the script editor and setting the type to javascript these scripts can be executed.
Thanks to JXA cookbook I was able to piece together the snippets.