Totally new to the concept of Extendscript so it's greek to me; but, I have an InDesign template containing 40 photos as a sort of "template" we use for funeral home clients; it display pictures in an album we print. Still, I have to go page by page after relinking to new photo sets, select all for that page, fit and center.
For the open document I want to fit the photos to pre-existing frames proportionally (fit proportionally), then center content--all for all 40 frames. (Note: there are other graphic frames and content, but I think a simple catch-all that manipulates all non-text would still work. Even if it manipulated text I could live with it).