Script from Silicon Publishing (www.siliconpublishing.com/blog/free-indesign-scripts)
Resizes the page to the size of the current selection.
Besides being useful (for instance, you may want a page sized to an image you just placed), these scripts show how to use the resolve() and reframe() functions for getting and setting item sizes. These are better than the often-used approach of simply changing an item’s "geometricBounds" property.