Make the OS X Dock nice and tidy…

If you want to add a spacer to the Document side of the dock, use this one instead:

Add a spacer to the Documents side of the dock:

-- add a spacer to the Application side of the Dock
-- add a spacer to the Document side of the Dock
do shell script "defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'"
-- restart the Dock
-- process names are case-sensitive!
do shell script "killall Dock"

Run whichever one you chose and you should see the Dock disappear then re-appear, complete with a blank ‘icon’. These icons, like any other icon in the Dock, can be dragged into place or dragged to the trash if you don’t want them anymore. Although I can’t see any reason why you’d want more than a couple of them, yes, you can have as many as you want.

Once you’ve sorted the script you want to use (or you’ve copied both) all you need to do is save them into ~/Library/Scripts/ – that’s just a fancy way of saying the Library/Scripts directory of your user profile. Why save them in there? Because if you go to back to the AppleScript Editor and open the preferences you’ll see an option with a check box called ‘Show Script menu in menu bar’.

AppleScript Preferences

Once you’ve enabled that you’ll see the AppleScript icon in the menu bar. Clicking it will show you a list of the scripts you’ve saved in ~/Library/Scripts/ (plus a couple others).

AppleScript Icon

Hope that helps someone tidy up their OS X Dock.