The Toolbox plugin has an action for this.
A rather long discussion on the plugin, with some examples linked …