This script contracts a selection that touches the document boundaries on one or more sides.
Note: This script is most useful for Photoshop CS2 and CS4 (and higher); it's less useful for Photoshop CS3, since that version allows you to contract selections that touch the canvas boundaries.