When you place a graphic (pdf or indd page, jpg/tif/psd/png image) you can set a number of options in the import options dialog. Once the file is placed, some options can be modified (object layer options for pdf/indd/psd, photoshop clipping path selection…) but some others parameters set in the import options dialog box are frozen (imported page number, "crop to" option for pdf/indd pages, profile and rendering intent for RGB images), unless you browse back to the file to place it again.
This script enables you to modify again the import parameters: first it brings back the import option dialog box of the selected graphic, then (besides that was actually its primary coding goal), in the event of "crop to" option changed (for example, switching from trim box to bleed box), it restores the previous scale and centering of the graphic in the graphic frame.
(You can also deselect the Preference > File Handling > "Preserve Image Dimensions" option — but the pdf will then grow relatively to its upper left corner whereas this script sees that it doesn't move at all by keeping the graphic centered.)
 See also: